]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: fix SO_RCVLOWAT hangs with fat skbs
authorEric Dumazet <edumazet@google.com>
Tue, 12 May 2020 13:54:30 +0000 (06:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 May 2020 19:49:47 +0000 (12:49 -0700)
commit021059ac8ea0cda6b2176380c021621b8d2a6eea
treeab86c8315f4652959c283cb29739dfeb437da15a
parent8cf966b6604e4c6b989aa43632cc293b829c34d7
tcp: fix SO_RCVLOWAT hangs with fat skbs

We autotune rcvbuf whenever SO_RCVLOWAT is set to account for 100%
overhead in tcp_set_rcvlowat()

This works well when skb->len/skb->truesize ratio is bigger than 0.5

But if we receive packets with small MSS, we can end up in a situation
where not enough bytes are available in the receive queue to satisfy
RCVLOWAT setting.
As our sk_rcvbuf limit is hit, we send zero windows in ACK packets,
preventing remote peer from sending more data.

Even autotuning does not help, because it only triggers at the time
user process drains the queue. If no EPOLLIN is generated, this
can not happen.

Note poll() has a similar issue, after commit
5981ebbada2e ("tcp: Respect SO_RCVLOWAT in tcp_poll().")

Fixes: 83cc0c6df61d ("tcp: avoid extra wakeups for SO_RCVLOWAT users")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp.c
net/ipv4/tcp_input.c