Dev

Linux 7.2 Kernel Makes Reading /proc/filesystems Up to 444% Faster

Linux 7.2 kernel speeds up /proc/filesystem reads by up to 444%. The filesystem list, which libselinux references far more often than expected, has been dramatically improved through RCU conversion and pre-generation.

4 min read Reviewed & edited by the SINGULISM Editorial Team

Linux 7.2 Kernel Makes Reading /proc/filesystems Up to 444% Faster
Photo by Gabriel Heinzer on Unsplash

One notable optimization headed for the Linux 7.2 kernel is improved read performance for /proc/filesystems. According to a Phoronix report, this change delivers up to a 444% speedup.

/proc/filesystems is a virtual file that provides a list of filesystems supported by the running kernel. At first glance, it might not seem like a frequently referenced file, but in reality it is read with surprising frequency. The cause lies in references made by the SELinux library (libselinux).

The Unexpectedly Heavy /proc/filesystems

libselinux is linked into a large number of programs. This scope extends even to programs not directly related to SELinux, such as editors and shell utilities. In the pull request for this optimization, Christian Brauner noted: “Because libselinux reads /proc/filesystems, this file is read very often. The number of programs affected is surprisingly large, including command-line tools like sed.”

In the previous implementation, reading /proc/filesystems required the kernel to traverse a manually managed linked list and generate strings in printf format for each entry. Because this process involved pointer chasing and sequential string generation, it created non-negligible overhead in environments with high access frequency.

The Effect of RCU Conversion and Pre-generation

The improvements introduced in the Linux 7.2 kernel consist of multiple elements.

The first change is converting the filesystem list to use RCU (Read-Copy-Update). RCU is a synchronization mechanism that allows lock-free read-only access, minimizing read-side overhead. In the old implementation, opening /proc/filesystems required reference count management each time; RCU conversion eliminates these operations.

The second change is pre-generation and caching of the output strings. Previously, every read triggered sequential string conversion of all entries. In the new implementation, as long as the filesystem list remains unchanged, pre-generated strings are returned from cache. This completely eliminates pointer chasing and sequential printf calls.

The third change introduces a mechanism to mark /proc files as permanent from outside the fs/proc/ directory. This allows filesystem-related code to manipulate /proc’s internal structure more appropriately.

Impact on Real-World Performance

The 444% speedup is not merely theoretical. Because many programs link against libselinux, the effect is expected to be especially pronounced in server and container environments.

Specifically, bottlenecks are eliminated in operations that frequently retrieve the filesystem list, such as container startup, file access control checks, and system call wrapper processing. In environments running many containers, this change can contribute to overall system responsiveness.

Linus Torvalds merged this improvement into the Linux 7.2 kernel. The Linux 7.2 kernel is positioned as a major release containing numerous performance improvements, and this optimization is part of that effort.

Editorial Opinion

This optimization serves as a reminder of the impact that “unexpected bottlenecks” can have on real-world system performance. The fact that a seemingly low-load file like /proc/filesystems is accessed frequently due to library linkage highlights the importance of system-wide profiling. In the short term, organizations that update to Linux 7.2, especially those with SELinux enabled, should observe improvements in system call latency. In environments with frequent container startup/shutdown or CI/CD pipelines, the cumulative effect is significant.

In the long term, the techniques used here—RCU conversion combined with pre-generation and caching—can be applied to other /proc files and sysfs optimizations. This pattern, which improves performance of virtual filesystems with high read frequency and low write frequency, may influence future kernel development. Furthermore, this case shows how a small kernel change can greatly impact userspace performance, highlighting the difficulty of engineering trade-offs.

We at the editorial team ask: Are there other files under /proc that might benefit from similar optimizations? And is there a need for a more systematic way to evaluate how userspace linking structures affect kernel optimization decisions?

References

Frequently Asked Questions

What causes /proc/filesystems to be read frequently?
The SELinux library (libselinux) is linked into many programs. From basic commands like sed to server processes, programs that link libselinux read /proc/filesystems at startup.
What mechanism achieves this optimization?
There are three main elements: converting the filesystem list to RCU, pre-generating and caching output strings, and a mechanism to mark /proc files as permanent. These eliminate the previous linked-list traversal and sequential printf processing, reducing read overhead.
In what environments can the 444% speedup be expected?
The improvement is most noticeable in systems running many programs linked against libselinux, such as container environments and servers. Environments with frequent container startup or file access control checks will see better overall system responsiveness.
Source: Phoronix

Comments

← Back to Home