lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ea17c90-4df5-4c0b-b574-c82e9411b6d8@redhat.com>
Date: Thu, 18 Sep 2025 08:38:31 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: 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,
 "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next 10/10] udp: use skb_attempt_defer_free()

On 9/17/25 6:32 PM, Eric Dumazet wrote:
> On Wed, Sep 17, 2025 at 9:15 AM Paolo Abeni <pabeni@...hat.com> wrote:
>> On 9/16/25 6:09 PM, Eric Dumazet wrote:
>>> Move skb freeing from udp recvmsg() path to the cpu
>>> which allocated/received it, as TCP did in linux-5.17.
>>>
>>> This increases max thoughput by 20% to 30%, depending
>>> on number of BH producers.
>>>
>>> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>>> ---
>>>  net/ipv4/udp.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
>>> index 7d1444821ee51a19cd5fd0dd5b8d096104c9283c..0c40426628eb2306b609881341a51307c4993871 100644
>>> --- a/net/ipv4/udp.c
>>> +++ b/net/ipv4/udp.c
>>> @@ -1825,6 +1825,13 @@ void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)
>>>       if (unlikely(READ_ONCE(udp_sk(sk)->peeking_with_offset)))
>>>               sk_peek_offset_bwd(sk, len);
>>>
>>> +     if (!skb_shared(skb)) {
>>> +             if (unlikely(udp_skb_has_head_state(skb)))
>>> +                     skb_release_head_state(skb);
>>> +             skb_attempt_defer_free(skb);
>>> +             return;
>>> +     }
>>> +
>>>       if (!skb_unref(skb))
>>>               return;
>>
>> What about consolidating the release path with something alternative
>> like the following, does the skb_unref()/additional smp_rmb() affects
>> performances badly?
>>
>> Thanks,
>>
>> Paolo
>> ---
>> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
>> index cc3ce0f762ec..ed2e370ad4de 100644
>> --- a/net/ipv4/udp.c
>> +++ b/net/ipv4/udp.c
>> @@ -1836,7 +1836,7 @@ void skb_consume_udp(struct sock *sk, struct
>> sk_buff *skb, int len)
>>          */
>>         if (unlikely(udp_skb_has_head_state(skb)))
>>                 skb_release_head_state(skb);
>> -       __consume_stateless_skb(skb);
>> +       skb_attempt_defer_free(skb);
> 
> This will not work, skb_attempt_defer_free(skb) wants to perform an skb_unref(),
> from skb_defer_free_flush()

Whoops, I missed that, thanks for pointing out!

I'm fine with this.

Cheers,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ