lib/test_vmalloc.c: allow built-in execution
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Thu, 17 Apr 2025 16:12:14 +0000 (18:12 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:34 +0000 (17:48 -0700)
Remove the dependency on module loading ("m") for the vmalloc test suite,
enabling it to be built directly into the kernel, so both ("=m") and
("=y") are supported.

Motivation:
- Faster debugging/testing of vmalloc code;
- It allows to configure the test via kernel-boot parameters.

Configuration example:
  test_vmalloc.nr_threads=64
  test_vmalloc.run_test_mask=7
  test_vmalloc.sequential_test_order=1

Link: https://lkml.kernel.org/r/20250417161216.88318-2-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Adrian Huang <ahuang12@lenovo.com>
Tested-by: Adrian Huang <ahuang12@lenovo.com>
Cc: Christop Hellwig <hch@infradead.org>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/Kconfig.debug
lib/test_vmalloc.c

index f9051ab610d54358b21d61c141b737bb345b4cee..166b9d830a85a2cbaf3b41bb01c847017d44f374 100644 (file)
@@ -2574,8 +2574,7 @@ config TEST_BITOPS
 config TEST_VMALLOC
        tristate "Test module for stress/performance analysis of vmalloc allocator"
        default n
-       depends on MMU
-       depends on m
+       depends on MMU
        help
          This builds the "test_vmalloc" module that should be used for
          stress and performance analysis. So, any new change for vmalloc
index 399751022eead73cd68b8a8109134e1a3e0d3eb1..1b0b59549aaf111e7fc090e69b682074137ec593 100644 (file)
@@ -591,10 +591,11 @@ static void do_concurrent_test(void)
        kvfree(tdriver);
 }
 
-static int vmalloc_test_init(void)
+static int __init vmalloc_test_init(void)
 {
        do_concurrent_test();
-       return -EAGAIN; /* Fail will directly unload the module */
+       /* Fail will directly unload the module */
+       return IS_BUILTIN(CONFIG_TEST_VMALLOC) ? 0:-EAGAIN;
 }
 
 module_init(vmalloc_test_init)