Re: Is sendfile all that sexy?

Linus Torvalds (torvalds@transmeta.com)
Mon, 22 Jan 2001 10:54:00 -0800 (PST)


On Mon, 22 Jan 2001, Val Henson wrote:

> On Wed, Jan 17, 2001 at 11:32:35AM -0800, Linus Torvalds wrote:
> >
> > However, for socket->socket, we would not have such an advantage. A
> > socket->socket sendfile() would not avoid any copies the way the
> > networking is done today. That _may_ change, of course. But it might
> > not. And I'd rather tell people using sendfile() that you get EINVAL if
> > it isn't able to optimize the transfer..
>
> Yes, socket->socket sendfile is not that sexy. I actually did this
> for 2.2.16 in the obvious (and stupid) way, copying data into a buffer
> and writing it it out again. The performance was unsurprisingly
> _exactly_ identical to a userspace read()/write() loop.

The thing is, that if I knew that I could always beat the user-space
numbers (by virtue of having fewer system calls etc), I would still
consider "sendfile()" to be ok for it.

But we can actually do _worse_ in sendfile() than in user-space
applications. For example, userspace "read+write" may now more about
packet boundary behaviour etc, which sendfile is totally clueless about,
so a userspace application might actually get _better_ performance by
doing it by hand.

That's why I currently want sendfile() to only work for the things we
_know_ we can do better.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/