]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cgroup: replace global cgroup_file_kn_lock with per-cgroup_file lock
authorShakeel Butt <shakeel.butt@linux.dev>
Wed, 11 Mar 2026 01:01:01 +0000 (18:01 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 11 Mar 2026 22:16:21 +0000 (12:16 -1000)
commit4ef420b3450026b56807e5d53001f80eb495403c
tree032a895c6628d08085f3bcd31a9e68a403fc4f84
parent4616120fca7f6d48b4c640e3975352e451e9c2ce
cgroup: replace global cgroup_file_kn_lock with per-cgroup_file lock

Replace the global cgroup_file_kn_lock with a per-cgroup_file spinlock
to eliminate cross-cgroup contention as it is not really protecting
data shared between different cgroups.

The lock is initialized in cgroup_add_file() alongside timer_setup().
No lock acquisition is needed during initialization since the cgroup
directory is being populated under cgroup_mutex and no concurrent
accessors exist at that point.

Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup-defs.h
kernel/cgroup/cgroup.c