Thread (5 messages) 5 messages, 2 authors, 2021-10-04

[PATCH 2/4] cgroup: reorder cgroup_subsys fields to save 8 byte

STALE1825d

From: Wei Yang <hidden>
Date: 2021-10-04 08:49:40
Also in: lkml
Subsystem: control group (cgroup), the rest · Maintainers: Tejun Heo, Johannes Weiner, Michal Koutný, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help