3 ms·
Realistically, you'd also have to track the allocation, and deallocation, of the range the file is being mmap(2)d into. sendfile(2) (it appears, I don't really
by andrewf 16y ago
Realistically, you'd also have to track the allocation, and deallocation, of the range the file is being mmap(2)d into.
sendfile(2) (it appears, I don't really spend time in the Linux kernel) piggybacks on the kernel's pipe code; it allocates some non-contiguous buffer pages in kernel space, but it doesn't map any new pages, and it doesn't allocate enough pages for the entire file.
It's also been around (and presumably making things faster) for over ten years. That's a long time to let a hypothetical future "best" triumph over an achievable "okay".