]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cgroup: reduce cgroup_file_kn_lock hold time in cgroup_file_notify()
authorShakeel Butt <shakeel.butt@linux.dev>
Wed, 11 Mar 2026 01:00:59 +0000 (18:00 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 11 Mar 2026 22:16:21 +0000 (12:16 -1000)
commit05070cd654f38346d051b8c411faff196fa58880
treec3345845cbb27bca7b745d2d909991fb28eb2ca3
parent5b30afc20b3fea29b9beb83c6415c4ff06f774aa
cgroup: reduce cgroup_file_kn_lock hold time in cgroup_file_notify()

cgroup_file_notify() calls kernfs_notify() while holding the global
cgroup_file_kn_lock.  kernfs_notify() does non-trivial work including
wake_up_interruptible() and acquisition of a second global spinlock
(kernfs_notify_lock), inflating the hold time.

Take a kernfs_get() reference under the lock and call kernfs_notify()
after dropping it, following the pattern from cgroup_file_show().

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