[PATCH 2/4] cgroup: reorder cgroup_subsys fields to save 8 byte
From: Wei Yang
Date: Mon Oct 04 2021 - 04:49:39 EST
On 64bit platform, struct is aligned by 8 bytes by default.
By moving cgroup_subsys.depends_on, we fit these adjacent fields into
8 bytes alignment.
Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
include/linux/cgroup-defs.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index f6d80896daab..4649d09396fd 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -672,6 +672,15 @@ struct cgroup_subsys {
*/
bool threaded:1;
+ /*
+ * A subsystem may depend on other subsystems. When such subsystem
+ * is enabled on a cgroup, the depended-upon subsystems are enabled
+ * together if available. Subsystems enabled due to dependency are
+ * not visible to userland until explicitly enabled. The following
+ * specifies the mask of subsystems that this one depends on.
+ */
+ u16 depends_on;
+
/* the following two fields are initialized automatically during boot */
int id;
const char *name;
@@ -698,14 +707,6 @@ struct cgroup_subsys {
struct cftype *dfl_cftypes; /* for the default hierarchy */
struct cftype *legacy_cftypes; /* for the legacy hierarchies */
- /*
- * A subsystem may depend on other subsystems. When such subsystem
- * is enabled on a cgroup, the depended-upon subsystems are enabled
- * together if available. Subsystems enabled due to dependency are
- * not visible to userland until explicitly enabled. The following
- * specifies the mask of subsystems that this one depends on.
- */
- u16 depends_on;
};
extern struct percpu_rw_semaphore cgroup_threadgroup_rwsem;
--
2.23.0