Subject: Re: sys_sendfile.
To: Jeff Roberson <>
From: PER4MANCE, J. Dolecek <>
List: tech-kern
Date: 04/04/2000 11:48:57
Jeff Roberson wrote:
> What I have done is implemented what I call the 'two copy pseudo sendfile'
> which gives little performance gain.  I started off this way to make sure I
> had written an interface that is compatible with Linux.  Basically I do the
> same thing a user space application would.  I allocate a buffer and use
> dofileread() and dofilewrite() in a loop.

This avoids the context switching only, right ?

> This is not exactly an optimal solution.  What I would like to do is query
> the object that I'm reading from in an abstract/clean/correct manor for the
> first contiguous block of memory and also how long this block is.  Then I

You'd need probably to create a hook into filesystems so that you can
pass directly the contents of bufs. There was some discussion some time
ago about this issue, I dimly recall Chunk said UVM loadout could
help implementing this feature. It should be in mail archives, search
by "splice". I can't dig out the URL to splice paper ATM, but it
should be somewhere in the achives. The paper would be
definitely worth looking at, to avoid reinventing a wheel :)

IIRC there was also some discusion of zero-copy path in the kernel,
primarily to be used by splice/sendfile implementation.

Note there is another project of sendfile() implementation, it's
in NetBSD projects page:
Maybe you can divide some work with the guy.