News › performance

Linux 7.4 kernfs changes target lock contention behind daemon stalls

By The Linux Camp News, October 21, 2026

Meta's kernfs work removes reader locking from path revalidation and shortens directory-listing lock holds. The reported throughput gain applies to concurrent cgroup and device churn, not general application performance.

Meta's 18-patch kernfs scalability work is reported merged for Linux 7.4 by Phoronix in the sources retrieved October 21, 2026. Christian Brauner submitted the pull request on October 16. The changes address locking bottlenecks affecting cgroupfs and sysfs readers. This is development-cycle inclusion, not evidence that a final release or a supported distribution kernel contains the work. 1 3 2

Kernfs supplies infrastructure for Linux pseudo-filesystems such as sysfs. At Meta, the problem reached beyond slow file access: Shakeel Butt reported minutes-long stalls in daemons polling cgroupfs and sysfs. These included oomd, which chooses processes to kill under memory exhaustion, and below, which records diagnostic telemetry. The operational consequence is that memory-pressure intervention and the evidence needed to investigate an incident can both be delayed. 1 2

The bottleneck is a reader-writer semaphore, kernfs_rwsem, shared per kernfs root rather than per file. Creation, removal and renaming need its write side. Once a writer queues, new readers cannot bypass it. Previously, checking each component of a pathname acquired the read side, so repeated polling alongside cgroup creation or device renaming could leave a stream of readers sleeping behind a writer. 3 2

The revalidation callback, which checks pathname entries, no longer takes that semaphore. It uses the parent inode and name already supplied by the virtual filesystem layer, prepares the directory revision counter for lockless reads, and compares namespace pointers instead of dereferencing them. Brauner explains that the remaining state is atomic or uses RCU-protected pointers, allowing the callback to run under RCU rather than adding reader-lock traffic. 2 3

Directory listing gets a separate fix. Previously, kernfs held the semaphore while dir_emit() copied entries to userspace. Under memory pressure, a fault during that copy could enter memory reclaim while retaining the read lock needed by filesystem writers. Brauner reports Meta seeing 120-second allocation stalls in below's filldir64() path, with systemd-oomd blocked behind it. Dropping the lock around dir_emit() removes that particular coupling between userspace copying, reclaim and filesystem locking. 3

Butt's revalidation benchmark used an 8-CPU VM with readers walking cgroupfs and sysfs while another thread changed cgroups and devices. Reader path-walk throughput improved 35–53%; read-lock acquisitions fell from 48,593,360 to 1,280,280, and contentions from 1,744,517 to 429,846. These are contributor-reported results for that workload, not a general application-speed improvement or a measurement of production stall reduction. 2

For operators investigating similar stalls, the supported diagnostic lead is whether polling daemons are waiting in kernfs_dop_revalidate() while cgroups or devices are changing. That is an inference from Meta's reported failure mode, not proof that every stalled monitor has this cause. The supplied sources do not establish distribution availability, backport plans or the performance effect on systems without concurrent churn. 2 1

This does not enable full RCU path walking, the lookup mode that avoids heavier synchronization across a pathname traversal. Butt says LOOKUP_RCU still returns -ECHILD because the permission callback forces a fallback before child entries are revalidated; fixing that is separate work. He also reports that rejection of deactivated, renamed and namespace-moved entries, and invalidation of cached missing entries, retain their previous behavior. 2 3

Sources

Courses