Re: [PATCH v2 6/6] slub_kunit: Add a test for the kmalloc_partition boot parameter

From: Kees Cook

Date: Sat Oct 31 2026 - 00:29:38 EST


On Thu, Oct 29, 2026 at 02:09:21PM +0800, Chris Down wrote:
> Check that the kmalloc partitions are separate caches by default, and
> alias the normal kmalloc caches when they're turned off with
> kmalloc_partition=0.
>
> Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
> ---
> lib/tests/slub_kunit.c | 46 ++++++++++++++++++++++++++++++++++++++++++
> mm/slab.h | 4 ++++
> mm/slab_common.c | 3 ++-
> 3 files changed, 52 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tests/slub_kunit.c b/lib/tests/slub_kunit.c
> index 670645875b27..e3035864577d 100644
> --- a/lib/tests/slub_kunit.c
> +++ b/lib/tests/slub_kunit.c
> @@ -333,6 +333,49 @@ static void test_slab_buckets(struct kunit *test)
> }
> #endif
>
> +#ifdef CONFIG_KMALLOC_PARTITION_CACHES

Same feedback as the other test: let's get rid of all this ifdef-ery :)

--
Kees Cook