]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "udp: do rmem bulk free even if the rx sk queue is empty"
authorPaolo Abeni <pabeni@redhat.com>
Tue, 21 Jan 2020 15:50:49 +0000 (16:50 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jan 2020 20:09:03 +0000 (21:09 +0100)
This reverts commit 2924ededf5aee34832d15ff2451d6d54f93de966.

Williem reported that after commit 2924ededf5ae ("udp: do rmem bulk
free even if the rx sk queue is empty") the memory allocated by
an almost idle system with many UDP sockets can grow a lot.

For stable kernel keep the solution as simple as possible and revert
the offending commit.

Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Diagnosed-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 2924ededf5ae ("udp: do rmem bulk free even if the rx sk queue is empty")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c

index 93a355b6b09242e9adc597e49589c6d0e4c71f71..030d43c7c957f03227efa4a3775b5b1468f40dc8 100644 (file)
@@ -1368,7 +1368,8 @@ static void udp_rmem_release(struct sock *sk, int size, int partial,
        if (likely(partial)) {
                up->forward_deficit += size;
                size = up->forward_deficit;
-               if (size < (sk->sk_rcvbuf >> 2))
+               if (size < (sk->sk_rcvbuf >> 2) &&
+                   !skb_queue_empty(&up->reader_queue))
                        return;
        } else {
                size += up->forward_deficit;