Re: [PATCH] net: iterate online nodes in skb_defer_free_flush()

From: Eric Dumazet

Date: Thu Sep 10 2026 - 22:39:39 EST


On Thu, Sep 10, 2026 at 7:07 PM Kris Pan <kris.pan@xxxxxxxxx> wrote:
>
> skb_attempt_defer_free() only queues skbs on the current CPU's node
> (numa_node_id() of a running CPU), which is always online, so the
> flush loop never needs to visit nodes that are merely possible.
>
> for_each_node() walks node_possible_map. On machines where the
> possible map is much larger than the online map -- e.g. a POWER10
> LPAR with 32 possible but 1 online node -- the flush loop touches 31
> cold, always-empty per-node lists on every softirq pass, showing up
> as skb_defer_free_flush() and _find_next_bit() overhead.
>
> Use for_each_online_node() to iterate only node_online_map.
>
> Loopback UDP throughput in a QEMU guest with 32 possible / 1 online
> nodes (bench_udp, 8 senders, 6 interleaved runs) improves by ~5%.
>
> Fixes: 5628f3fe3b16 ("net: add NUMA awareness to skb_attempt_defer_free()")
> Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-lkp/202512112119.5b9829a-lkp@xxxxxxxxx
> Signed-off-by: Kris Pan <kris.pan@xxxxxxxxx>
> ---
> net/core/dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 290e0f099e6bf..b528b6a986fcf 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -6907,7 +6907,7 @@ static void skb_defer_free_flush(void)
> struct skb_defer_node *sdn;
> int node;
>
> - for_each_node(node) {
> + for_each_online_node(node) {

SGTM, but you probably could have added

Suggested-by: Adrian Tomasov <atomasov@xxxxxxxxxx>

(Assuming you read
https://lore.kernel.org/oe-lkp/20260910143041.18106-1-atomasov@xxxxxxxxxx/)

Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>

Thanks.