Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit f3c60ab

Browse files
Waiman-Longgregkh
authored andcommitted
cgroup: Move rcu_head up near the top of cgroup_root
commit a7fb042 upstream. Commit d23b5c5 ("cgroup: Make operations on the cgroup root_list RCU safe") adds a new rcu_head to the cgroup_root structure and kvfree_rcu() for freeing the cgroup_root. The current implementation of kvfree_rcu(), however, has the limitation that the offset of the rcu_head structure within the larger data structure must be less than 4096 or the compilation will fail. See the macro definition of __is_kvfree_rcu_offset() in include/linux/rcupdate.h for more information. By putting rcu_head below the large cgroup structure, any change to the cgroup structure that makes it larger run the risk of causing build failure under certain configurations. Commit 77070ee ("cgroup: Avoid false cacheline sharing of read mostly rstat_cpu") happens to be the last straw that breaks it. Fix this problem by moving the rcu_head structure up before the cgroup structure. Fixes: d23b5c5 ("cgroup: Make operations on the cgroup root_list RCU safe") Reported-by: Stephen Rothwell <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Waiman Long <[email protected]> Acked-by: Yafang Shao <[email protected]> Reviewed-by: Yosry Ahmed <[email protected]> Reviewed-by: Michal Koutný <[email protected]> Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6419341 commit f3c60ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/cgroup-defs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,10 @@ struct cgroup_root {
543543
/* Unique id for this hierarchy. */
544544
int hierarchy_id;
545545

546+
/* A list running through the active hierarchies */
547+
struct list_head root_list;
548+
struct rcu_head rcu; /* Must be near the top */
549+
546550
/*
547551
* The root cgroup. The containing cgroup_root will be destroyed on its
548552
* release. cgrp->ancestors[0] will be used overflowing into the
@@ -556,10 +560,6 @@ struct cgroup_root {
556560
/* Number of cgroups in the hierarchy, used only for /proc/cgroups */
557561
atomic_t nr_cgrps;
558562

559-
/* A list running through the active hierarchies */
560-
struct list_head root_list;
561-
struct rcu_head rcu;
562-
563563
/* Hierarchy-specific flags */
564564
unsigned int flags;
565565

0 commit comments

Comments
 (0)