diff options
author | Soheil Hassas Yeganeh <soheil@google.com> | 2020-09-14 23:52:10 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-15 01:58:24 +0200 |
commit | afb83012cc7236c8f5cefbd0fd4ba628ec34ce02 (patch) | |
tree | 3c28059b9ec5d3443bc0bd5c73893a5b3d2e0657 /arch/s390 | |
parent | tcp: return EPOLLOUT from tcp_poll only when notsent_bytes is half the limit (diff) | |
download | linux-afb83012cc7236c8f5cefbd0fd4ba628ec34ce02.tar.xz linux-afb83012cc7236c8f5cefbd0fd4ba628ec34ce02.zip |
tcp: schedule EPOLLOUT after a partial sendmsg
For EPOLLET, applications must call sendmsg until they get EAGAIN.
Otherwise, there is no guarantee that EPOLLOUT is sent if there was
a failure upon memory allocation.
As a result on high-speed NICs, userspace observes multiple small
sendmsgs after a partial sendmsg until EAGAIN, since TCP can send
1-2 TSOs in between two sendmsg syscalls:
// One large partial send due to memory allocation failure.
sendmsg(20MB) = 2MB
// Many small sends until EAGAIN.
sendmsg(18MB) = 64KB
sendmsg(17.9MB) = 128KB
sendmsg(17.8MB) = 64KB
...
sendmsg(...) = EAGAIN
// At this point, userspace can assume an EPOLLOUT.
To fix this, set the SOCK_NOSPACE on all partial sendmsg scenarios
to guarantee that we send EPOLLOUT after partial sendmsg.
After this commit userspace can assume that it will receive an EPOLLOUT
after the first partial sendmsg. This EPOLLOUT will benefit from
sk_stream_write_space() logic delaying the EPOLLOUT until significant
space is available in write queue.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/s390')
0 files changed, 0 insertions, 0 deletions