sendfile(2) SF_NOPUSH flag proposal

Igor Sysoev is at rambler-co.ru
Tue May 27 08:59:34 PDT 2003


On Tue, 27 May 2003, Terry Lambert wrote:

> Peter Jeremy wrote:
> > On Tue, May 27, 2003 at 11:57:20AM +0400, Igor Sysoev wrote:
> > >I thought about it more and I agree with you. TF_NOPUSH should be turned on
> > >at the start of a transaction and turned off at the end of a transaction.
> > >
> > >So I think there should be two flags:
> > >SF_NOPUSH - it turns TF_NOPUSH on before the sending. It's cheap:
> > >SF_PUSH - it turns TF_NOPUSH off after the sending has been completed.
> > 
> > I agree that the code appears trivial but in order to justify its
> > inclusion, you will need to demonstrate that there is some benefit to
> > FreeBSD to implement this code.  Good justification would be:
> > 
> > 1) The same API is implemented somewhere else (or there is agreement
> >    between multiple groups to implement it).  I don't believe this
> >    functionality is implemented anywhere else and you've not provided
> >    any evidence that any other groups are considering such functionality.
> 
> Actually, the functionality can be implemented *without* going
> and implementing the API.  It should really be contrlled already
> by the TCP_NODELAY option *not* having been set by the user, and,
> for last-block next-first-block coelescing, by TCP_NOPUSH *having*
> been set.

It's not an implementing the API. It's an addition to the already existed
API - sendfile(2). sendfile(2) already has the flags parameter and this
parameter is currently unused and should be zero. I propose two sendfile(2)
flags - SF_NOPUSH and SF_PUSH.

> > 2) The new feature provides significant performance benefit.   In this
> >    case, I believe the overhead of calling setsockopt(2) is negligible
> >    so the performance gain would be negligible.
> 
> The overhead of toggling it would be costly.  However, I really
> don't understand why he isn't just not setting TCP_NODELAY in
> the first place, since it's an affirmative option, and then
> leaaving the socket alone to act like it's supposed to act.

TCP_NODELAY is not set.


Igor Sysoev
http://sysoev.ru/en/



More information about the freebsd-arch mailing list