A simple optimization led by Mateusz Guzik is poised to significantly improve file opening speeds in the upcoming Linux 7.4 kernel release. The change addresses a duplication in directory entry handling during the file opening process.
Open-source developer Mateusz Guzik has been working for over two years on a patch to optimize the Linux kernel’s `do_open()` VFS function, which is used when opening files from a pathname lookup. Currently, the process involves a duplicate directory entry, or “dentry,” used to translate the path component to the disk inode. Guzik’s optimization removes this redundant dentry.
According to Guzik, as stated in the patch, “Opening a file grabs a reference on the terminal dentry in __legitimize_path(), then another one in do_dentry_open() and finally drops the initial reference in terminate_walk(). That's 2 modifications which don't need to be there, do_dentry_open() can consume the already held reference instead.” Benchmarking on a 20-core virtual machine demonstrated a 39% increase in operations per second when opening the same file in read-only mode.
The three-dozen line patch has been queued into the VFS.git’s vfs-7.4.lookup Git branch and is expected to be submitted for inclusion in the Linux 7.4 merge window. The improvement is anticipated to be available in the stable kernel before the end of 2026. Guzik noted that it is “a bit surprising such low-hanging fruit was left in the Linux kernel this long.”
Read the original coverage
💬 Comments
📜 Comment Policy