From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Eric Dumazet <edumazet@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>
Subject: [PATCH net-next] net: adopt SLUB sheaves for skbuff_small_head
Date: Sat, 28 Feb 2026 14:12:52 +0000 [thread overview]
Message-ID: <20260228141252.435509-1-edumazet@google.com> (raw)
skbuff_small_head is used both on receive and send paths,
serving potentially 80 million allocations and frees per second.
Tuning it on large servers has been problematic, especially
on AMD Turins platforms, where "lock cmpxch16b" latency can
be over 30,000 cycles.
Switching to SLUB sheaves fixes the issue nicely.
tcp_rr benchmark with 10,000 flows goes from 25 Mpps to 40 Mpps
on AMD Turin.
Other platforms show benefits with tcp_rr with more than 30,000
flows.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
---
net/core/skbuff.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 513cbfed19bc34bbb6767cdd7a50dad68be430fb..79eb7eb6eea9aa4a76c555e6ddd33bf0bc84c921 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5174,6 +5174,19 @@ static void skb_extensions_init(void) {}
void __init skb_init(void)
{
+ struct kmem_cache_args kmem_args_small_head = {
+ .align = 0,
+ .ctor = NULL,
+ /* usercopy should only access first SKB_SMALL_HEAD_HEADROOM
+ * bytes.
+ * struct skb_shared_info is located at the end of skb->head,
+ * and should not be copied to/from user.
+ */
+ .useroffset = 0,
+ .usersize = SKB_SMALL_HEAD_HEADROOM,
+ .sheaf_capacity = 32,
+ };
+
net_hotdata.skbuff_cache = kmem_cache_create_usercopy("skbuff_head_cache",
sizeof(struct sk_buff),
0,
@@ -5189,17 +5202,13 @@ void __init skb_init(void)
0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL);
- /* usercopy should only access first SKB_SMALL_HEAD_HEADROOM bytes.
- * struct skb_shared_info is located at the end of skb->head,
- * and should not be copied to/from user.
- */
- net_hotdata.skb_small_head_cache = kmem_cache_create_usercopy("skbuff_small_head",
- SKB_SMALL_HEAD_CACHE_SIZE,
- 0,
- SLAB_HWCACHE_ALIGN | SLAB_PANIC,
- 0,
- SKB_SMALL_HEAD_HEADROOM,
- NULL);
+
+ net_hotdata.skb_small_head_cache = kmem_cache_create(
+ "skbuff_small_head",
+ SKB_SMALL_HEAD_CACHE_SIZE,
+ &kmem_args_small_head,
+ SLAB_HWCACHE_ALIGN | SLAB_PANIC);
+
skb_extensions_init();
}
--
2.53.0.473.g4a7958ca14-goog
next reply other threads:[~2026-02-28 14:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 14:12 Eric Dumazet [this message]
2026-02-28 19:51 ` [PATCH net-next] net: adopt SLUB sheaves for skbuff_small_head Kuniyuki Iwashima
2026-03-01 8:32 ` Jason Xing
2026-03-01 11:24 ` Vlastimil Babka
2026-03-01 16:30 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260228141252.435509-1-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox