diff options
| author | Shakeel Butt <shakeel.butt@linux.dev> | 2026-09-12 19:14:51 -0700 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-25 16:59:11 +0200 |
| commit | 4424f06120fda0f63f3d9e9992990d7790d902a4 (patch) | |
| tree | 1f692103b9bae82d36e73f502e6a8ad178263eb9 /tools/lib/python | |
| parent | 7f24d0f60b1087dbc28d68398957c18774e5a7d8 (diff) | |
| download | linux-next-4424f06120fda0f63f3d9e9992990d7790d902a4.tar.gz linux-next-4424f06120fda0f63f3d9e9992990d7790d902a4.zip | |
kernfs: activate a new node without dropping kernfs_rwsem
kernfs_add_one() links the node in, drops the kernfs_rwsem write lock,
then calls kernfs_activate(), which takes it again. Roots that do not
set KERNFS_ROOT_CREATE_DEACTIVATED, such as sysfs, therefore pay two
write locks for every file, directory and symlink created.
A new node has no children, so kernfs_activate() would walk only that
node. Call kernfs_activate_one() before dropping the lock instead. Its
two WARN_ON_ONCE()s still hold: the node was just linked, and nothing
can have changed its active count yet. This also closes the window
where a node is linked but not yet activated.
lock_stat, creating and destroying five dummy netdevs:
before after
kernfs_rwsem write acquires 1200 830
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://patch.msgid.link/20260913021453.21507-2-shakeel.butt@linux.dev
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
