Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: advance skb_defer_disable_key check in napi_consume_skb

When net.core.skb_defer_max is adjusted to zero, napi_consume_skb()
shouldn't go into that deeper in skb_attempt_defer_free() because it adds
an additional pair of local_bh_enable/disable() which is evidently not
needed. Advancing the check of the static key saves more cycles and
benefits non defer case.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Link: https://patch.msgid.link/20260402034114.65766-1-kerneljasonxing@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jason Xing and committed by
Jakub Kicinski
8a4e3ab6 1ef05ed2

+3 -1
+3 -1
net/core/skbuff.c
··· 94 94 95 95 #include "dev.h" 96 96 #include "devmem.h" 97 + #include "net-sysfs.h" 97 98 #include "netmem_priv.h" 98 99 #include "sock_destructor.h" 99 100 ··· 1520 1519 1521 1520 DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 1522 1521 1523 - if (skb->alloc_cpu != smp_processor_id() && !skb_shared(skb)) { 1522 + if (!static_branch_unlikely(&skb_defer_disable_key) && 1523 + skb->alloc_cpu != smp_processor_id() && !skb_shared(skb)) { 1524 1524 skb_release_head_state(skb); 1525 1525 return skb_attempt_defer_free(skb); 1526 1526 }