aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2017-04-06 21:47:57 -0400
committerTejun Heo <tj@kernel.org>2017-04-10 20:06:17 -0400
commitb8b1a2e5eca6bbf20e3a29c5f9db8331ec52af2d (patch)
tree1f64f1e97e59af97c7322df5703184032d28b2cd
parent30e03acda5fd9c77ec9bf8b3c5def9540c6b0486 (diff)
cgroup: move cgroup_subsys_state parent field for cache locality
Various structures embed a struct cgroup_subsys_state, typically at the top of the containing structure. It is common for code that accesses the structures to perform operations that iterate over the chain of parent css pointers, also accessing data in each containing structure. In particular, struct cpuacct is used by fairly hot code paths in the scheduler such as cpuacct_charge(). Move the parent css pointer field to the end of the structure to increase the chances of residing in the same cache line as the data from the containing structure. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--include/linux/cgroup-defs.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index c74b78ecd583..21745946cae1 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -107,9 +107,6 @@ struct cgroup_subsys_state {
107 /* reference count - access via css_[try]get() and css_put() */ 107 /* reference count - access via css_[try]get() and css_put() */
108 struct percpu_ref refcnt; 108 struct percpu_ref refcnt;
109 109
110 /* PI: the parent css */
111 struct cgroup_subsys_state *parent;
112
113 /* siblings list anchored at the parent's ->children */ 110 /* siblings list anchored at the parent's ->children */
114 struct list_head sibling; 111 struct list_head sibling;
115 struct list_head children; 112 struct list_head children;
@@ -139,6 +136,12 @@ struct cgroup_subsys_state {
139 /* percpu_ref killing and RCU release */ 136 /* percpu_ref killing and RCU release */
140 struct rcu_head rcu_head; 137 struct rcu_head rcu_head;
141 struct work_struct destroy_work; 138 struct work_struct destroy_work;
139
140 /*
141 * PI: the parent css. Placed here for cache proximity to following
142 * fields of the containing structure.
143 */
144 struct cgroup_subsys_state *parent;
142}; 145};
143 146
144/* 147/*