Re: [PATCH V2 0/2] slub_kunit: add a test case for {kmalloc,kfree}_nolock

From: Vlastimil Babka (SUSE)

Date: Tue Apr 07 2026 - 05:44:21 EST


On 4/6/26 11:09, Harry Yoo (Oracle) wrote:
> Test bots don't seem to test kmalloc_nolock() and kfree_nolock(), so
> subtle bugs are discovered late. To make it easier to test, add a kunit
> test case that stresses these paths by combining a tight alloc/free loop
> with perf-triggered interrupts that invoke {kmalloc,kfree}_nolock() from
> the overflow handler.
>
> While at it, also add the missing MAINTAINERS entry for slub_kunit.c.

While it's late, this only adds a tests, so added to slab/for-next, thanks!

> v1->v2:
> - Fix build errors on arches without CONFIG_PERF_EVENTS (Thanks
> Vlastimil)
> - Rename some identifiers
> - Use GFP_KERNEL_ACCOUNT or GFP_KERNEL for kmalloc(), instead of 0 or
> __GFP_ACCOUNT (that was unnecessarily restrictive).
>
> p.s. I was writing this test while developing kvfree_rcu_nolock(),
> let's add a test case in advance.
>
> Probably a similar test case for the page allocator is worth adding
> but I'm not sure where the right place would be.

lib/tests/page_alloc_kunit.c? ;)

>
> v1: https://lore.kernel.org/linux-mm/20260330120517.104743-1-harry@xxxxxxxxxx
>
> Harry Yoo (Oracle) (2):
> MAINTAINERS: add lib/tests/slub_kunit.c to SLAB ALLOCATOR section
> lib/tests/slub_kunit: add a test case for {kmalloc,kfree}_nolock
>
> MAINTAINERS | 1 +
> lib/tests/slub_kunit.c | 92 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 93 insertions(+)
>
>
> base-commit: dbc785fb4d9cfa0115e69e614fe20b4ab90f8366