Much improved sendfile(2) kernel implementation
    Gary Jennejohn 
    garyj at jennejohn.org
       
    Thu Sep 21 05:28:07 PDT 2006
    
    
  
On Wed, Sep 20, 2006 at 11:59:13PM +0200, Andre Oppermann wrote:
> I have rewritten kern_sendfile() to work in two loops, the inner which turns
> as many pages into mbufs as it can up to the free send socket buffer space.
> The outer loop then drops the whole mbuf chain into the send socket buffer,
> calls tcp_output() on it and then waits until 50% of the socket buffer are
> free again to repeat the cycle.  This way tcp_output() gets the full amount
> of data to work with and can issue up to 64K sends for TSO to chop up in the
> network adapter without using any CPU cycles.  Thus it gets very efficient
> especially with the readahead the VM and I/O system do.
> 
> The patch is available here:
>  http://people.freebsd.org/~andre/sendfile-20060920.diff
>
My vesion of gcc (3.4.4) doesn't like the omin() macro. I had to change it
to this:
#define        omin(a, b) ((off_t)a < (off_t)b ? (off_t)a : (off_t)b)
Otherwise I haven't seen any catastrophies yet, but it's only been running
for a few minutes ;-)
-- 
Gary Jennejohn / garyjATjennejohnDOTorg gjATfreebsdDOTorg garyjATdenxDOTde
    
    
More information about the freebsd-current
mailing list