diff --git a/src/task.h b/src/task.h
index c0c9e47ee4ca221f9f960256e9208c749ae523ea..ac326fa1cf069eeb6159806b284396d251ff604f 100644
--- a/src/task.h
+++ b/src/task.h
@@ -52,7 +52,7 @@ enum task_types {
   task_type_grav_up,
   task_type_grav_external,
   task_type_count
-};
+} __attribute__((packed));
 
 /**
  * @brief The different task sub-types (for pairs, selfs and sub-tasks).
@@ -65,7 +65,7 @@ enum task_subtypes {
   task_subtype_grav,
   task_subtype_tend,
   task_subtype_count
-};
+} __attribute__((packed));
 
 /**
  * @brief The type of particles/objects this task acts upon in a given cell.
@@ -94,35 +94,32 @@ extern const char *subtaskID_names[];
  */
 struct task {
 
-  /*! Type of the task */
-  enum task_types type;
+  /*! Pointers to the cells this task acts upon */
+  struct cell *ci, *cj;
 
-  /*! Sub-type of the task (for the tasks that have one */
-  enum task_subtypes subtype;
+  /*! List of tasks unlocked by this one */
+  struct task **unlock_tasks;
+
+  /*! Start and end time of this task */
+  ticks tic, toc;
 
   /*! Flags used to carry additional information (e.g. sort directions) */
   int flags;
 
-  /*! Number of unsatisfied dependencies */
-  int wait;
-
   /*! Rank of a task in the order */
   int rank;
 
   /*! Weight of the task */
   int weight;
 
-  /*! Pointers to the cells this task acts upon */
-  struct cell *ci, *cj;
-
   /*! ID of the queue or runner owning this task */
-  int rid;
+  short int rid;
 
   /*! Number of tasks unlocked by this one */
-  int nr_unlock_tasks;
+  short int nr_unlock_tasks;
 
-  /*! List of tasks unlocked by this one */
-  struct task **unlock_tasks;
+  /*! Number of unsatisfied dependencies */
+  short int wait;
 
 #ifdef WITH_MPI
 
@@ -134,8 +131,11 @@ struct task {
 
 #endif
 
-  /*! Start and end time of this task */
-  ticks tic, toc;
+  /*! Type of the task */
+  enum task_types type;
+
+  /*! Sub-type of the task (for the tasks that have one */
+  enum task_subtypes subtype;
 
   /*! Should the scheduler skip this task ? */
   char skip;