[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKPip5QppUDo_NT-KrZ4Lg+maqJ6_zz0-NpVwbuR8yomw@mail.gmail.com>
Date: Wed, 17 Sep 2025 08:57:45 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Willem de Bruijn <willemb@...gle.com>, Kuniyuki Iwashima <kuniyu@...gle.com>, David Ahern <dsahern@...nel.org>,
netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next 05/10] udp: refine __udp_enqueue_schedule_skb() test
On Wed, Sep 17, 2025 at 8:00 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> Eric Dumazet wrote:
> > Commit 5a465a0da13e ("udp: Fix multiple wraparounds
> > of sk->sk_rmem_alloc.") allowed to slightly overshoot
> > sk->sk_rmem_alloc, when many cpus are trying
> > to feed packets to a common UDP socket.
> >
> > This patch, combined with the following one reduces
> > false sharing on the victim socket under DDOS.
>
> It also changes the behavior. There was likely a reason to allow
> at least one packet if the buffer is small. Kuniyuki?
It should not change the behavior.
rmem would be zero if there is no packet in the queue : We still
accept the incoming skb, regardless of its truesize.
If there is any packet, rmem > 0
>
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > ---
> > net/ipv4/udp.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> > index cca41c569f37621404829e096306ba7d78ce4d43..edd846fee90ff7850356a5cb3400ce96856e5429 100644
> > --- a/net/ipv4/udp.c
> > +++ b/net/ipv4/udp.c
> > @@ -1739,8 +1739,8 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
> > if (rcvbuf > INT_MAX >> 1)
> > goto drop;
> >
> > - /* Always allow at least one packet for small buffer. */
> > - if (rmem > rcvbuf)
> > + /* Accept the packet if queue is empty. */
> > + if (rmem)
> > goto drop;
> > }
> >
> > --
> > 2.51.0.384.g4c02a37b29-goog
> >
>
>
Powered by blists - more mailing lists