New readfile() System Call Under Review For Reading Small~Medium Files Faster
The proposed readfile system call allows reading small to medium sized files in one shot without having to issue separate open/read/close system calls. The readfile system call just takes a file descriptor, filename, buffer and its size, and any flags. The file is then straight into the buffer without having to worry about any open/close operations. The intended use-case besides just small~medium files is for those user-space applications often reading from procfs/sysfs that are inherently small.
Besides readfile() being simpler, the other intended use-case is for helping in performance due to less system calls. Greg does note that utilizing readfile should help performance, especially due to "syscall overheads go up over time due to various CPU bugs being addressed." A.k.a. Spectre, Meltdown, etc.
The readfile system call review is in this kernel thread. Hopefully it will be reviewed punctually and well to possibly make it into the Linux 5.9 cycle next month.