Thread (7 messages) 7 messages, 4 authors, 8d ago

Re: [PATCH net-next v3] net: skb: isolate skb data area allocations into a separate bucket

From: Harry Yoo <harry@kernel.org>
Date: 2026-07-08 13:28:00
Also in: linux-hardening, linux-mm, lkml


On 7/8/26 8:16 PM, Pedro Falcato wrote:
On Wed, Jul 08, 2026 at 10:30:50AM +0200, Paolo Abeni wrote:
quoted
On 7/2/26 7:07 PM, Pedro Falcato wrote:> @@ -586,6 +586,8 @@ struct
sk_buff *napi_build_skb(void *data, unsigned int frag_size)
quoted
 }
 EXPORT_SYMBOL(napi_build_skb);
 
+static kmem_buckets *skb_data_buckets __ro_after_init;
+
 static void *kmalloc_pfmemalloc(size_t obj_size, gfp_t flags, int node)
 {
 	if (!gfp_pfmemalloc_allowed(flags))
@@ -593,7 +595,8 @@ static void *kmalloc_pfmemalloc(size_t obj_size, gfp_t flags, int node)
 	if (!obj_size)
 		return kmem_cache_alloc_node(net_hotdata.skb_small_head_cache,
 					     flags, node);
-	return kmalloc_node_track_caller(obj_size, flags, node);
+	return kmem_buckets_alloc_node_track_caller(skb_data_buckets, obj_size,
+						    flags, node);
Sashiko noted that some drivers may require GFP_DMA buckets, and the
above may break them:

https://sashiko.dev/#/patchset/20260702170728.168755-1-pfalcato%40suse.de
Oh, this is really awkward. Adding linux-mm and slab maintainers for input here.

Considering the current slab bucketing does not seem to duplicate DMA or
CGROUP caches, could it make sense to duplicate those as well?
Could we specify what kmalloc types the user needs when creating
kmem_buckets and duplicate caches for the requested kmalloc types only?
Otherwise we could add a branch like:

if (gfp_flags & __GFP_DMA)
	/* use the global dma kmalloc caches */
-- 
Cheers,
Harry / Hyeonggon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help