OSDN Git Service

tcp: return EPOLLOUT from tcp_poll only when notsent_bytes is half the limit
authorSoheil Hassas Yeganeh <soheil@google.com>
Mon, 14 Sep 2020 21:52:09 +0000 (17:52 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Sep 2020 23:58:24 +0000 (16:58 -0700)
commit8ba3c9d1c6d75d1e6af2087278b30e17f68e1fff
treedf6b4e7b5a19abda719a7ad98e369630f70af454
parented6d9b0228132fee03314b276d946fc3f0cc9e4f
tcp: return EPOLLOUT from tcp_poll only when notsent_bytes is half the limit

If there was any event available on the TCP socket, tcp_poll()
will be called to retrieve all the events.  In tcp_poll(), we call
sk_stream_is_writeable() which returns true as long as we are at least
one byte below notsent_lowat.  This will result in quite a few
spurious EPLLOUT and frequent tiny sendmsg() calls as a result.

Similar to sk_stream_write_space(), use __sk_stream_is_writeable
with a wake value of 1, so that we set EPOLLOUT only if half the
space is available for write.

Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c