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>
This commit is contained in:
Shakeel Butt 2026-03-10 18:01:01 -07:00 • committed by Tejun Heo
commit 4ef420b345
2 changed files with 9 additions and 16 deletions