[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251125200041.1565663-10-jon@nutanix.com>
Date: Tue, 25 Nov 2025 13:00:36 -0700
From: Jon Kohler <jon@...anix.com>
To: netdev@...r.kernel.org, Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Jason Wang <jasowang@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
linux-kernel@...r.kernel.org (open list)
Cc: Jon Kohler <jon@...anix.com>
Subject: [PATCH net-next v2 9/9] tun: flush deferred skb free list before bulk NAPI cache get
Call skb_defer_free_flush() immediately before invoking
napi_skb_cache_get_bulk() in the XDP batch path. This ensures any
deferred skb frees are processed so that the NAPI skb cache is refilled
just in time for use. Keeping the cache warm helps reduce unnecessary
IPIs during heavy transmit workloads.
Signed-off-by: Jon Kohler <jon@...anix.com>
---
drivers/net/tun.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index b48a66b39e0a..7d7f1ddcb707 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2589,6 +2589,12 @@ static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
rcu_read_lock();
bpf_net_ctx = bpf_net_ctx_set(&__bpf_net_ctx);
+ /* Attempt to flush deferred free list immediately
+ * prior to bulk get, which will help repopulate the local
+ * cache and help reduce the amount of IPIs a TX hot core
+ * will receive when the defer list grows high.
+ */
+ skb_defer_free_flush();
num_skbs = napi_skb_cache_get_bulk(skbs, n);
for (i = 0; i < num_skbs; i++) {
--
2.43.0
Powered by blists - more mailing lists