From: Kees Cook <kees@kernel.org>
To: Pedro Falcato <pfalcato@suse.de>, Harry Yoo <harry@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
Jason Xing <kerneljasonxing@gmail.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-mm@kvack.org,
Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [PATCH net-next v3] net: skb: isolate skb data area allocations into a separate bucket
Date: Wed, 15 Jul 2026 22:54:48 -0700 [thread overview]
Message-ID: <153C14E7-738D-4411-9F7A-F3A33DABB4EC@kernel.org> (raw)
In-Reply-To: <aldpAY6nXwgayHL0@pedro-suse.lan>
On July 15, 2026 4:07:49 AM PDT, Pedro Falcato <pfalcato@suse.de> wrote:
>On Wed, Jul 08, 2026 at 10:27:54PM +0900, Harry Yoo wrote:
>>
>>
>> On 7/8/26 8:16 PM, Pedro Falcato wrote:
>> > On Wed, Jul 08, 2026 at 10:30:50AM +0200, Paolo Abeni wrote:
>> >> 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)
>> >>> }
>> >>> 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?
>
>Perhaps. But do the users themselves know? alloc_skb() allows users to specify
>random __GFP flags. We're bound to see some random caller do
>alloc_skb(__GFP_ACCOUNT) ;)
>
>In all honesty, I'm not quite sure what the best way forward here is. The most
>transparent way is to bucket those other kmalloc types as well, but that might
>very trivially result in a lot more caches (and possibly memory usage) for no
>great reason. So perhaps specifying caches might do.
How about dropping non-standard flag alloc requests into the general kmalloc buckets? (I.e. have kmem_buckets_alloc redirect on flag mismatch?)
-Kees
--
Kees Cook
prev parent reply other threads:[~2026-07-16 5:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 17:07 [PATCH net-next v3] net: skb: isolate skb data area allocations into a separate bucket Pedro Falcato
2026-07-08 8:30 ` Paolo Abeni
2026-07-08 11:16 ` Pedro Falcato
2026-07-08 13:27 ` Harry Yoo
2026-07-15 11:07 ` Pedro Falcato
2026-07-16 2:10 ` Harry Yoo
2026-07-16 5:54 ` Kees Cook [this message]
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=153C14E7-738D-4411-9F7A-F3A33DABB4EC@kernel.org \
--to=kees@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=harry@kernel.org \
--cc=horms@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
/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