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: <CAL+tcoDaB+ghuLZyGgcjubqobKuh0Qsfr5eKYdrOzEnCq9nCUQ@mail.gmail.com>
Date: Mon, 17 Nov 2025 16:54:09 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Kuniyuki Iwashima <kuniyu@...gle.com>, netdev@...r.kernel.org, eric.dumazet@...il.com, 
	Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Subject: Re: [PATCH v3 net-next 3/3] net: use napi_skb_cache even in process context

On Mon, Nov 17, 2025 at 4:41 PM Jason Xing <kerneljasonxing@...il.com> wrote:
>
> On Mon, Nov 17, 2025 at 9:07 AM Jason Xing <kerneljasonxing@...il.com> wrote:
> >
> > On Mon, Nov 17, 2025 at 4:27 AM Eric Dumazet <edumazet@...gle.com> wrote:
> > >
> > > This is a followup of commit e20dfbad8aab ("net: fix napi_consume_skb()
> > > with alien skbs").
> > >
> > > Now the per-cpu napi_skb_cache is populated from TX completion path,
> > > we can make use of this cache, especially for cpus not used
> > > from a driver NAPI poll (primary user of napi_cache).
> > >
> > > We can use the napi_skb_cache only if current context is not from hard irq.
> > >
> > > With this patch, I consistently reach 130 Mpps on my UDP tx stress test
> > > and reduce SLUB spinlock contention to smaller values.
> > >
> > > Note there is still some SLUB contention for skb->head allocations.
> > >
> > > I had to tune /sys/kernel/slab/skbuff_small_head/cpu_partial
> > > and /sys/kernel/slab/skbuff_small_head/min_partial depending
> > > on the platform taxonomy.
> > >
> > > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> >
> > Reviewed-by: Jason Xing <kerneljasonxing@...il.com>
> >
> > Thanks for working on this. Previously I was thinking about this as
> > well since it affects the hot path for xsk (please see
> > __xsk_generic_xmit()->xsk_build_skb()->sock_alloc_send_pskb()). But I
> > wasn't aware of the benefits between disabling irq and allocating
> > memory. AFAIK, I once removed an enabling/disabling irq pair and saw a
> > minor improvement as this commit[1] says. Would you share your
> > invaluable experience with us in this case?
> >
> > In the meantime, I will do more rounds of experiments to see how they perform.
>
> Tested-by: Jason Xing <kerneljasonxing@...il.com>
> Done! I managed to see an improvement. The pps number goes from
> 1,458,644 to 1,647,235 by running [2].
>
> But sadly the news is that the previous commit [3] leads to a huge
> decrease in af_xdp from 1,980,000 to 1,458,644. With commit [3]
> applied, I observed and found xdpsock always allocated the skb on cpu
> 0 but the napi poll triggered skb_attempt_defer_free() on another
> call[4], which affected the final results.

Typo: on another cpu.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ