sendfile(2) SF_NOPUSH flag proposal

Matthew Dillon dillon at apollo.backplane.com
Thu May 29 09:20:52 PDT 2003


:Bill Fenner wrote:
:> Why not set PRUS_MORETOCOME on all but the final pru_send() call?
:
:If the file is larger than `sysctl net.inet.tcp.sendspace`, then
:this code in do_sendfile():
:
:                if (sbspace(&so->so_snd) < so->so_snd.sb_lowat) {
:                        if (so->so_state & SS_NBIO) {
:                                m_freem(m);
:                                sbunlock(&so->so_snd);
:                                splx(s);
:                                error = EAGAIN;
:                                goto done;
:                        }
:                        error = sbwait(&so->so_snd);
:
:will result in you sleeping with PRUS_MORETOCOME set, but with
:no more being sent because the send buffer doesn't get emptied,
:as it's waiting for more data to send.
:
:-- Terry

     Not unless the send buffer is substantially near the size of a single
     packet, which it isn't (it's far larger).  PRUS_MORETOCOME is smarter
     then that, Terry.  tcp_output() just uses it as a hint, it doesn't 
     unconditionally hold off a flush.

     The code to refer to is netinet/tcp_output.c around line 313 (in stable),
     in tcp_output().  The section within the if (len) { ... } sequence.
     This section does all tests related to sending a packet and as you can
     see TF_MORETOCOME will not prevent the data from being flushed the
     more there is enough to fill a packet.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>


More information about the freebsd-arch mailing list