Re: [PATCH v3 0/6] mm/slab: Support selecting slab hardening features at boot

From: Chris Down

Date: Sat Dec 05 2026 - 03:01:57 EST


Hi Harry,

Harry Yoo writes:
>For SLAB_FREELIST_RANDOM and SLAB_FREELIST_HARDENED, unconditionally
>compiling in the feature has negligible overhead so we could instead
>let them determine default behaviour instead of introducing _DEFAULT_ON
>configs.

Do you mean that slab_hardening= should be able to switch these two as
well? Since v2 the series only makes them default y and leaves them as
build time options, because their cost didn't show up at the system level
and so there didn't seem to be a reason to switch them per host. I'd
prefer to keep it that way for now. If someone does need that later, the
list syntax means they can be added to slab_hardening= then.

>For SLAB_BUCKETS, Vlastimil is working on making it less expensive to
>enable at runtime (which is inspired by your series)
>https://lore.kernel.org/linux-mm/20261203-kmalloc-entry-rework-v2-0-d718dc4fd906@xxxxxxxxxx
>
> "If this is accepted, [1] should be rebased on it as it makes the
> slab_buckets boot-time handling really straightforward. In fact
> CONFIG_SLAB_BUCKETS could be repurposed to only control the default
> behavior, while the code is always compiled in."

Yes, that sounds good to me, and it's a lot nicer than adding another
config option. I'll rebase v4 on top of Vlastimil's series and drop
SLAB_HARDENING_DEFAULT_ON. I tried that on top of his v2, and it does
make the buckets side a lot simpler.

>For KMALLOC_PARTITION_CACHES I don't have strong opinion on having
>_DEFAULT_ON flag for this, but I'd argue it's fairly reasonable to
>assume it's on by default when it's compiled in, as compiling in the
>feature has _some_ overhead already.

Agreed, I'll keep it on by default when it's built in.

Thanks!

Chris