Reading /proc/filesystems Is Surprisingly Done Very Often & Now As Much As 444% Faster
Reading /proc/filesystems for obtaining a list of file-systems supported by the running kernel is done frequently on Linux. Namely due to being read by the SELinux library (libselinux), reading of /proc/filesystems is done more often than one would typically expect and now the Linux 7.2 kernel is optimizing for it to yield much better performance.
The most surprising optimization I have seen so far that is aligned for the Linux 7.2 kernel is around /proc/filesystems to deliver more efficient performance with how frequently it is accessed. With now pre-generating the /proc/file-systems string and the file-system list being RCU'ified, the performance can be as much as 444% faster than current Linux kernel releases.
Christian Brauner explained in the pull request revamping the /proc/filesystems handling for Linux 7.2:
And indeed it delivers on a dramatic improvement given how frequently /proc/filesystems is read:
Linus Torvalds merged this nice improvement today for Linux 7.2.
The most surprising optimization I have seen so far that is aligned for the Linux 7.2 kernel is around /proc/filesystems to deliver more efficient performance with how frequently it is accessed. With now pre-generating the /proc/file-systems string and the file-system list being RCU'ified, the performance can be as much as 444% faster than current Linux kernel releases.
Christian Brauner explained in the pull request revamping the /proc/filesystems handling for Linux 7.2:
"The file was a mess with a hand-rolled linked list in desperate need of a cleanup. The filesystems list is now RCU-ified, /proc files can be marked permanent from outside fs/proc/, and the string emitted when reading /proc/filesystems is pre-generated and cached instead of pointer-chasing and printfing entry by entry on every read. The file is read frequently because libselinux reads it and is linked into numerous frequently used programs (even ones you would not suspect, like sed!). Scalability also improves since reference maintenance on open/close is bypassed."
And indeed it delivers on a dramatic improvement given how frequently /proc/filesystems is read:
👁 /proc/filesystems performance benchmark result
Linus Torvalds merged this nice improvement today for Linux 7.2.
