Re: [PATCH v2 2/6] mm/slab: Enable SLAB_FREELIST_RANDOM by default
From: Kees Cook
Date: Sat Oct 31 2026 - 00:15:42 EST
On Thu, Oct 29, 2026 at 02:07:55PM +0800, Chris Down wrote:
> SLAB_FREELIST_RANDOM randomises the order in which the objects in a new
> slab are handed out. Like SLAB_FREELIST_HARDENED, most distros already
> enable it, and its cost is only paid when a new slab is set up.
>
> With it on, the same system level benchmarks didn't change measurably.
> Allocating from new slabs does get slower, by up to about 30% per object
> in a microbenchmark which does little else.
>
> So let's enable it by default too. SHUFFLE_PAGE_ALLOCATOR defaults to
> SLAB_FREELIST_RANDOM && ACPI_NUMA, so it's now built in by default on
> those systems, but page shuffling itself stays off unless it's enabled
> with page_alloc.shuffle.
>
> Suggested-by: Vlastimil Babka <vbabka@xxxxxxxxxx>
> Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
Again, just like it should be. I wonder, though, don't these 2 changes
undercut the goal of making these boot-time selectable?
Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
--
Kees Cook