* [PATCH] net: iterate online nodes in skb_defer_free_flush()
@ 2026-09-11 2:04 Kris Pan
2026-09-11 2:38 ` [PATCH v2] " Kris Pan
2026-09-11 2:39 ` [PATCH] " Eric Dumazet
0 siblings, 2 replies; 6+ messages in thread
From: Kris Pan @ 2026-09-11 2:04 UTC (permalink / raw)
To: edumazet
Cc: davem, kuba, pabeni, horms, atomasov, oliver.sang, netdev,
linux-kernel, Kris Pan
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@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202512112119.5b9829a-lkp@intel.com
Signed-off-by: Kris Pan <kris.pan@intel.com>
---
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) {
sdn = this_cpu_ptr(net_hotdata.skb_defer_nodes) + node;
if (llist_empty(&sdn->defer_list))
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2] net: iterate online nodes in skb_defer_free_flush()
2026-09-11 2:04 [PATCH] net: iterate online nodes in skb_defer_free_flush() Kris Pan
@ 2026-09-11 2:38 ` Kris Pan
2026-09-15 23:40 ` Jakub Kicinski
2026-09-11 2:39 ` [PATCH] " Eric Dumazet
1 sibling, 1 reply; 6+ messages in thread
From: Kris Pan @ 2026-09-11 2:38 UTC (permalink / raw)
To: edumazet
Cc: davem, kuba, pabeni, horms, atomasov, oliver.sang, netdev,
linux-kernel, Kris Pan
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@intel.com>
Suggested-by: Adrian Tomasov <atomasov@redhat.com>
Closes: https://lore.kernel.org/oe-lkp/202512112119.5b9829a-lkp@intel.com
Signed-off-by: Kris Pan <kris.pan@intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
---
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) {
sdn = this_cpu_ptr(net_hotdata.skb_defer_nodes) + node;
if (llist_empty(&sdn->defer_list))
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] net: iterate online nodes in skb_defer_free_flush()
2026-09-11 2:38 ` [PATCH v2] " Kris Pan
@ 2026-09-15 23:40 ` Jakub Kicinski
2026-09-15 23:53 ` Kris Pan
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2026-09-15 23:40 UTC (permalink / raw)
To: Kris Pan
Cc: edumazet, davem, pabeni, horms, atomasov, oliver.sang, netdev,
linux-kernel
On Fri, 11 Sep 2026 10:38:04 +0800 Kris Pan 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%.
Clashiko confirms this is racy:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260911023804.3503989-1-kris.pan@intel.com
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] net: iterate online nodes in skb_defer_free_flush()
2026-09-15 23:40 ` Jakub Kicinski
@ 2026-09-15 23:53 ` Kris Pan
2026-09-16 0:00 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Kris Pan @ 2026-09-15 23:53 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Kris Pan, edumazet, davem, pabeni, horms, atomasov, oliver.sang,
netdev, linux-kernel
Right, the node-offline race is real. I'll fix it in a v3 so the flush
doesn't depend on node_online_map, e.g. a per-CPU mask of pending nodes
set by the producer and drained by the flush.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] net: iterate online nodes in skb_defer_free_flush()
2026-09-15 23:53 ` Kris Pan
@ 2026-09-16 0:00 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2026-09-16 0:00 UTC (permalink / raw)
To: Kris Pan
Cc: Jakub Kicinski, davem, pabeni, horms, atomasov, oliver.sang,
netdev, linux-kernel
On Tue, Sep 15, 2026 at 4:56 PM Kris Pan <kris.pan@intel.com> wrote:
>
> Right, the node-offline race is real. I'll fix it in a v3 so the flush
> doesn't depend on node_online_map, e.g. a per-CPU mask of pending nodes
> set by the producer and drained by the flush.
Certainly not.
We should not add a per-CPU active-node bitmask updated by
skb_attempt_defer_free(),
as writing to a shared bitmask from remote CPUs would re-introduce the
cross-NUMA
cache line bouncing that commit 5628f3fe3b16 eliminated.
Instead, keep for_each_online_node(node) in the skb_defer_free_flush()
fast path,
and handle cleanup in the cold dev_cpu_dead(unsigned int oldcpu) hotplug path.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: iterate online nodes in skb_defer_free_flush()
2026-09-11 2:04 [PATCH] net: iterate online nodes in skb_defer_free_flush() Kris Pan
2026-09-11 2:38 ` [PATCH v2] " Kris Pan
@ 2026-09-11 2:39 ` Eric Dumazet
1 sibling, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2026-09-11 2:39 UTC (permalink / raw)
To: Kris Pan
Cc: davem, kuba, pabeni, horms, atomasov, oliver.sang, netdev, linux-kernel
On Thu, Sep 10, 2026 at 7:07 PM Kris Pan <kris.pan@intel.com> 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@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202512112119.5b9829a-lkp@intel.com
> Signed-off-by: Kris Pan <kris.pan@intel.com>
> ---
> 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@redhat.com>
(Assuming you read
https://lore.kernel.org/oe-lkp/20260910143041.18106-1-atomasov@redhat.com/)
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-16 0:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 2:04 [PATCH] net: iterate online nodes in skb_defer_free_flush() Kris Pan
2026-09-11 2:38 ` [PATCH v2] " Kris Pan
2026-09-15 23:40 ` Jakub Kicinski
2026-09-15 23:53 ` Kris Pan
2026-09-16 0:00 ` Eric Dumazet
2026-09-11 2:39 ` [PATCH] " Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®