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

From: Chris Down

Date: Fri Nov 13 2026 - 06:06:48 EST


Hi Kees,

Kees Cook writes:
Please don't ifdef to drop a test. If you have to do any ifdef, use it
for test skipping instead.

Sure. In v3 the test is always built, and it calls kunit_skip() when
CONFIG_SLAB_BUCKETS isn't set. The kmalloc_partition test in 6/6 gets the
same treatment.

This feels messy. Any reason not to just export it entirely and avoid
all the ifdefness?

No good reason. In v3 it's a normal global, declared in mm/slab.h
without any #if. It's still only exported with EXPORT_SYMBOL_IF_KUNIT,
since nothing other than the test needs it. kmalloc_partition_enabled
gets the same change.

Thanks!

Chris