public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Marco Elver <elver@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>, Dennis Zhou <dennis@kernel.org>,
	Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@gentwo.org>,
	Harry Yoo <harry@kernel.org>, Hao Li <hao.li@linux.dev>,
	David Rientjes <rientjes@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-hardening@vger.kernel.org,
	kasan-dev@googlegroups.com, llvm@lists.linux.dev,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Florent Revest <revest@google.com>, Jann Horn <jannh@google.com>,
	KP Singh <kpsingh@kernel.org>,
	Matteo Rizzo <matteorizzo@google.com>,
	GONG Ruiqi <gongruiqi1@huawei.com>
Subject: Re: [PATCH v2] slab: support for compiler-assisted type-based slab cache partitioning
Date: Wed, 22 Apr 2026 16:57:11 -0700	[thread overview]
Message-ID: <D3E316B3-9909-408E-85BF-647383810CFF@kernel.org> (raw)
In-Reply-To: <aejopk23CsntyFOB@elver.google.com>



On April 22, 2026 8:26:30 AM PDT, Marco Elver <elver@google.com> wrote:
>On Tue, Apr 21, 2026 at 09:13PM +0200, Marco Elver wrote:
>[...]
>> > And actually, perhaps a global rename of the options so the selection
>> > naming is at the end of the CONFIG phrase, and bundle the on/off into
>> > the choice:
>> >
>> >
>> > choice
>> >         prompt "Partitioned slab cache mode"
>> >         depends on PARTITION_KMALLOC_CACHES
>> >         default KMALLOC_PARTITION_TYPED if !SLUB_TINY && CC_HAS_ALLOC_TOKEN
>> >         default KMALLOC_PARTITION_RANDOM if !SLUB_TINY
>> >         default KMALLOC_PARTITION_NONE
>> >
>> > config KMALLOC_PARTITION_NONE
>> > ...
>> > config KMALLOC_PARTITION_RANDOM
>> >         depends on !SLUB_TINY
>> > ...
>> > config KMALLOC_PARTITION_TYPED
>> >         depends on !SLUB_TINY && CC_HAS_ALLOC_TOKEN
>> 
>> There was a comment somewhere else that even introducing
>> PARTITION_KMALLOC_CACHES might confuse users of RANDOM_KMALLOC_CACHES.
>> I think completely getting rid of and renaming RANDOM_KMALLOC_CACHES
>> has marginal benefit, and will cause friction for existing users (even
>> moreso than already). I see little benefit here, and would prefer not
>> to break user configs more than needed: configs that already set
>> RANDOM_KMALLOC_CACHES, upon rebuild will be prompted to enable
>> PARTITION_KMALLOC_CACHES; if user says Y, then their previous
>> selection (RANDOM) would already be picked and they don't have to
>> rediscover that it exists under a new name.
>> 
>> I can make this change, but only if you're sure the benefit outweighs
>> the downsides here.
>
>Upon further reflection, since the transition isn't smooth anyway, I'm
>probably going to rename, but have them all use the PARTITION_KMALLOC_*
>prefix so it's easy to just search for "CONFIG_PARTITION_KMALLOC_". I
>don't see the need for a "NONE" variant - I've seen this pattern
>elsewhere, and then you end up with users reading the .config and
>concluding "CONFIG_PARTITION_KMALLOC_CACHES is enabled ... but oh never
>mind actually it isn't" which I find confusing. This could be useful if
>we had a dynamic on/off toggle and the default is NONE, but that's not
>the case here.

There is now the "transitional" Kconfig keyword too, which should make it easy to move to the new name.

For the naming, I tend to prefer the noun-verb (e.g. timer_start()) and noun-feature-option ordering (e.g. CONFIG_SLAB_FREELIST_RANDOM). This feature isn't about partition tables, so I don't think the first word should be "partition". :)

As far as doing the full isolation later, yeah, that's fine, and I think with this Kconfig change it's easy to add a new mode.

-Kees

-- 
Kees Cook

      reply	other threads:[~2026-04-22 23:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 14:37 [PATCH v2] slab: support for compiler-assisted type-based slab cache partitioning Marco Elver
2026-04-16 13:42 ` Marco Elver
2026-04-20  7:25 ` Harry Yoo (Oracle)
2026-04-20  9:30   ` Marco Elver
2026-04-20 10:28     ` Harry Yoo (Oracle)
2026-04-21 17:22 ` Kees Cook
2026-04-21 19:13   ` Marco Elver
2026-04-22 15:26     ` Marco Elver
2026-04-22 23:57       ` 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=D3E316B3-9909-408E-85BF-647383810CFF@kernel.org \
    --to=kees@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=cl@gentwo.org \
    --cc=david@kernel.org \
    --cc=dennis@kernel.org \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gongruiqi1@huawei.com \
    --cc=gustavoars@kernel.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=jannh@google.com \
    --cc=justinstitt@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=matteorizzo@google.com \
    --cc=mhocko@suse.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    --cc=revest@google.com \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --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