]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cgroup: Make operations on the cgroup root_list RCU safe
authorYafang Shao <laoar.shao@gmail.com>
Sun, 29 Oct 2023 06:14:29 +0000 (06:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:10:40 +0000 (15:10 +0200)
commitde77545c72c428484fa16384dfa7d17f820e6d0c
tree47e6d42e82a0d5cb28c81e8d9c69c4ab2f23d74c
parentc031d286eceb82f72f8623b7f4abd2aa491bfb5e
cgroup: Make operations on the cgroup root_list RCU safe

[ Upstream commit d23b5c577715892c87533b13923306acc6243f93 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/cgroup-defs.h
kernel/cgroup/cgroup-internal.h
kernel/cgroup/cgroup.c