[lkml]   [2001]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Is sendfile all that sexy?
    On Wed, Jan 17, 2001 at 11:32:35AM -0800, Linus Torvalds wrote:
    > In article <Pine.LNX.4.30.0101171454340.29536-100000@baphomet.bogo.bogus>,
    > Ben Mansell <> wrote:
    > >
    > >The current sendfile() has the limitation that it can't read data from
    > >a socket. Would it be another 5-minute hack to remove this limitation, so
    > >you could sendfile between sockets? Now _that_ would be sexy :)
    > I don't think that would be all that sexy at all.
    > You have to realize, that sendfile() is meant as an optimization, by
    > being able to re-use the same buffers that act as the in-kernel page
    > cache as buffers for sending data. So you avoid one copy.
    > 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.

    There is a use for an optimized socket->socket transfer - proxying
    high speed TCP connections. It would be exciting if the zerocopy
    networking framework led to a decent socket->socket transfer.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:13    [W:0.025 / U:17.272 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site