summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYafang Shao <laoar.shao@gmail.com>2023-10-29 09:14:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-19 07:04:25 +0300
commitdd9542ae7c7ca82ed2d7c185754ba9026361f6bc (patch)
tree2e6728516d62e696b8966d08ac4b87b72867202d /include
parentbcd51480439499d5f8605ba2f3edb5bd0dd81fd8 (diff)
downloadlinux-dd9542ae7c7ca82ed2d7c185754ba9026361f6bc.tar.xz
cgroup: Make operations on the cgroup root_list RCU safe
commit d23b5c577715892c87533b13923306acc6243f93 upstream. At present, when we perform operations on the cgroup root_list, we must hold the cgroup_mutex, which is a relatively heavyweight lock. In reality, we can make operations on this list RCU-safe, eliminating the need to hold the cgroup_mutex during traversal. Modifications to the list only occur in the cgroup root setup and destroy paths, which should be infrequent in a production environment. In contrast, traversal may occur frequently. Therefore, making it RCU-safe would be beneficial. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> To: Michal Koutný <mkoutny@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/cgroup-defs.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 265da00a1a8b..7e7bc25a1aa3 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -558,6 +558,7 @@ struct cgroup_root {
/* A list running through the active hierarchies */
struct list_head root_list;
+ struct rcu_head rcu;
/* Hierarchy-specific flags */
unsigned int flags;