]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/tests/slub_kunit: add a test case for {kmalloc,kfree}_nolock
authorHarry Yoo (Oracle) <harry@kernel.org>
Mon, 6 Apr 2026 09:09:07 +0000 (18:09 +0900)
committerVlastimil Babka (SUSE) <vbabka@kernel.org>
Tue, 7 Apr 2026 09:21:32 +0000 (11:21 +0200)
commit92af129b4085cd561b59bfa1596653844cb82e4c
tree9cc268f83a1d4279cbe6ad2755e69f0c24c64f03
parent7711207dcb9b7b74270ea0fb21daf91e4291f21d
lib/tests/slub_kunit: add a test case for {kmalloc,kfree}_nolock

Testing invocation of {kmalloc,kfree}_nolock() during kmalloc() or
kfree() is tricky, and it is even harder to ensure that slowpaths are
properly tested. Lack of such testing has led to late discovery of
the bug fixed by commit a1e244a9f177 ("mm/slab: use prandom if
!allow_spin").

Add a slub_kunit test that allocates and frees objects in a tight loop
while a perf event triggers interrupts (NMI or hardirq depending on
the arch) on the same task, invoking {kmalloc,kfree}_nolock() from the
overflow handler.

Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
Link: https://patch.msgid.link/20260406090907.11710-3-harry@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
lib/tests/slub_kunit.c