Messages in this thread | | | Date | Fri, 15 Jul 2005 09:01:59 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] generic_file_sendpage |
| |
On Fri, 15 Jul 2005, Andrew Morton wrote: > > I don't know if we want to add this feature, really. It's such a > specialised thing.
It is, in this format, and I agree - I don't want to add it.
What I'd really like to see is somebody taking a look at my old "pipe as a zero-copy buffer" patches, which as an interface allowed arbitrary data to be copied between _any_ file descriptors, and allowed you to do things like mix input sources quite naturally (ie you could write a header first from a user-space buffer, then the contents of a file, and then push the result out to a socket, all with zero-copy).
"sendfile()" in general I think has been a mistake. It's too specialized, and the interface has always sucked. As Andrew pointed out, it actually needs to limit the number of buffers in flight partly because otherwise you have uninterruptible kernel work etc etc.
But more importantly, sendfile() was always broken as a interface for receiving data from anything but a page-cache based filesystem. That means that it's totally useless for a lot of things. The pipe-buffer thing ends up being a totally generic "in-kernel buffer" interface, and is a _lot_ more flexible.
For anybody interested in zero-copy work, here's a LWN write-up of some of the original discussion:
http://lwn.net/Articles/118750/
and my (very ugly) example patch can be found for example here:
http://groups-beta.google.com/group/linux.kernel/msg/782bd9e5cb647207?hl=en&
(it's not a a complete implementation, but it shows how to go from a file _to_ a pipe buffer, but not back to a file again).
I really want to get _rid_ of sendfile, not make any more of it.
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |