Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2006 16:53:26 +0000 (UTC)
From:      Andre Oppermann <andre@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/kern uipc_syscalls.c src/sys/sys libkern.h socket.h
Message-ID:  <200611021653.kA2GrRWx008044@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
andre       2006-11-02 16:53:26 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             uipc_syscalls.c 
    sys/sys              libkern.h socket.h 
  Log:
  Rewrite kern_sendfile() to work in two loops, the inner which turns as many
  VM 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 previous sendfile(2) code simply looped over the file, turned each 4K
  page into an mbuf and sent it off. This had the effect that TSO could only
  generate 2 packets per send instead of up to 44 at its maximum of 64K.
  
  Add experimental SF_MNOWAIT flag to sendfile(2) to return ENOMEM instead of
  sleeping on mbuf allocation failures.
  
  Benchmarking shows significant improvements (95% confidence):
   45% less cpu (or 1.81 times better) with new sendfile vs. old sendfile (non-TSO)
   83% less cpu (or 5.7 times better) with new sendfile vs. old sendfile (TSO)
  
  (Sender AMD Opteron 852 (2.6GHz) with em(4) PCI-X-133 interface and receiver
  DELL Poweredge SC1425 P-IV Xeon 3.2GHz with em(4) LOM connected back to back
  at 1000Base-TX full duplex.)
  
  Sponsored by:   TCP/IP Optimization Fundraise 2005
  MFC after:      3 month
  
  Revision  Changes    Path
  1.240     +280 -242  src/sys/kern/uipc_syscalls.c
  1.55      +2 -0      src/sys/sys/libkern.h
  1.91      +2 -1      src/sys/sys/socket.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611021653.kA2GrRWx008044>