Readfile System Call Patches Revisited For Efficiently Reading Small Files

Written by Michael Larabel in Linux Storage on 27 November 2022 at 10:08 AM EST. 15 Comments
Talked about for over two years now has been a "readfile" system call to efficiently read small files. This should be a win when dealing with small files like those exposed via sysfs while it's taken time to come together and stalled out several times. This week Greg Kroah-Hartman has updated the readfile patches leading to hope that this new syscall might finally be on a path for mainlining.

The readfile system call is rather simple and intended to simply open the given file, read it into the buffer, and close the file -- all within that single call rather than handling each of those steps separately. The intent is to use the readfile system call if frequently reading "tiny" to "small" files like those exposed under sysfs, procfs, etc.

The single system call approach should be more efficient with less syscall overhead, particularly if frequently reading to many small files.

As of Friday, Greg KH has re-based the readfile syscall patch, self tests, and related documentation on his driver-core.git's "readfile" branch.

As of writing the patches haven't yet worked their way to Greg's driver-core-next branch, but seeing the freshly updated readfile branch gives hope once again this simple system call may finally land after 2+ years of talk.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week