netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty"
@ 2020-01-21 15:50 Paolo Abeni
  2020-01-21 18:26 ` Willem de Bruijn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paolo Abeni @ 2020-01-21 15:50 UTC (permalink / raw)
  To: netdev; +Cc: Willem de Bruijn

This reverts commit 0d4a6608f68c7532dcbfec2ea1150c9761767d03.

Williem reported that after commit 0d4a6608f68c ("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: 0d4a6608f68c ("udp: do rmem bulk free even if the rx sk queue is empty")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/ipv4/udp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 93a355b6b092..030d43c7c957 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty"
  2020-01-21 15:50 [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty" Paolo Abeni
@ 2020-01-21 18:26 ` Willem de Bruijn
  2020-01-22 10:02 ` Sergei Shtylyov
  2020-01-22 20:10 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2020-01-21 18:26 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Network Development, Willem de Bruijn

On Tue, Jan 21, 2020 at 10:51 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> This reverts commit 0d4a6608f68c7532dcbfec2ea1150c9761767d03.
>
> Williem reported that after commit 0d4a6608f68c ("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: 0d4a6608f68c ("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>

Thanks Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty"
  2020-01-21 15:50 [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty" Paolo Abeni
  2020-01-21 18:26 ` Willem de Bruijn
@ 2020-01-22 10:02 ` Sergei Shtylyov
  2020-01-22 20:10 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2020-01-22 10:02 UTC (permalink / raw)
  To: Paolo Abeni, netdev; +Cc: Willem de Bruijn

Hello!

On 21.01.2020 18:50, Paolo Abeni wrote:

> This reverts commit 0d4a6608f68c7532dcbfec2ea1150c9761767d03.
> 
> Williem reported that after commit 0d4a6608f68c ("udp: do rmem bulk

    Willem (as below)?

> 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: 0d4a6608f68c ("udp: do rmem bulk free even if the rx sk queue is empty")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty"
  2020-01-21 15:50 [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty" Paolo Abeni
  2020-01-21 18:26 ` Willem de Bruijn
  2020-01-22 10:02 ` Sergei Shtylyov
@ 2020-01-22 20:10 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-01-22 20:10 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, willemdebruijn.kernel

From: Paolo Abeni <pabeni@redhat.com>
Date: Tue, 21 Jan 2020 16:50:49 +0100

> This reverts commit 0d4a6608f68c7532dcbfec2ea1150c9761767d03.
> 
> Williem reported that after commit 0d4a6608f68c ("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: 0d4a6608f68c ("udp: do rmem bulk free even if the rx sk queue is empty")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-22 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-21 15:50 [PATCH net] Revert "udp: do rmem bulk free even if the rx sk queue is empty" Paolo Abeni
2020-01-21 18:26 ` Willem de Bruijn
2020-01-22 10:02 ` Sergei Shtylyov
2020-01-22 20:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).