Readfile System Call Revised For Efficiently Reading Small Files

Written by Michael Larabel in Linux Kernel on 25 August 2022 at 12:30 PM EDT. 23 Comments
LINUX KERNEL
Brought up back in 2020 was the readfile system call for efficiently reading small files with the intention of it being simple for reading small files such as those via sysfs, procfs, and similar file-systems. The readfile patches were re-based yesterday against the current Linux 6.0 state, leaving hope that the new system call might finally be sent in for the next kernel cycle.

With the single "readfile" system call it would open the given file, read it into a buffer, and close the file rather than needing to make multiple system calls for conventional file input handling. Using readfile could be beneficial in cases of frequently reading a lot of small files, such as parsing of data exposed by the kernel via sysfs.

The readfile patches were revised after finding a potential user and updated again in 2021 but ultimately never being sent to mainline by Greg Kroah-Hartman.


Yesterday Greg re-based the readfile syscall patches against the current Linux 6.0-rc2 state and posted them to driver-core's readfile branch. We'll see if this time is the lucky go around and manages to be submitted for the v6.1 merge window for this more efficient reading of small files on Linux by cutting down on system call overhead.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week