Page MenuHomeFreeBSD

sendfile: keep the lowat hack more conservative
Needs ReviewPublic

Authored by glebius on Mon, Sep 28, 7:09 PM.

Details

Reviewers
gallatin
Group Reviewers
transport
Summary

First, record the original lowat value and later in the wait/EAGAIN loop
look at the original value, rather than on the value that we just faked.
This eliminates some blank syscalls, where socket was reported as writable
and immediate write instantly fails. In my testing the ratio of such
syscalls was really small, under 2%, however in a different scenario this
negative effect can be more profound.

Second, cap the lowat growth to 1/2 of original socket buffer size, rather
than to current size. The problem was there before, but it became more
profound after 587c6c121504.

Note: we are considering to evaluate if the lowat hack is needed at all.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77423
Build 74306: arc lint + arc unit

Event Timeline

tuexen added inline comments.
sys/kern/kern_sendfile.c
663

Some part of this code is protocol agnostic. For example, line 1153 checks if the protocol is TCP. Does it therefore make sense to use a TCP specific variable here unconditionally?

sys/kern/kern_sendfile.c
663

This sendfile_wait_generic() should actually be tcp_sendfile_wait() and live in tcp_usrreqs.c. The current state is a bit of misconception that eventually is going to be fixed.