[PATCH] lib/test_vmalloc.c: Fix compile error with CONFIG_TINY_RCU

Uladzislau Rezki (Sony) posted 1 patch 9 months, 3 weeks ago
lib/test_vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] lib/test_vmalloc.c: Fix compile error with CONFIG_TINY_RCU
Posted by Uladzislau Rezki (Sony) 9 months, 3 weeks ago
When the kernel is built with CONFIG_TINY_RCU, compiling the
test_vmalloc.c fails, due to conflicting definitions like
"struct srcu_usage", etc. between "srcutiny.h" and "srcutree.h".

It happens because of direct including the "srcutree.h" bypassing
the automatic selection mechanism. A correct approach is to include
a generic <linux/srcu.h> which properly select SRCU implementation
based on a kernel configuration.

Fix it by replacing the "srcutree.h" include with "srcu.h".

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202504190717.tJHs381f-lkp@intel.com/
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
 lib/test_vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
index 6d65ef725d42c..1b0b59549aaf1 100644
--- a/lib/test_vmalloc.c
+++ b/lib/test_vmalloc.c
@@ -15,7 +15,7 @@
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <linux/rcupdate.h>
-#include <linux/srcutree.h>
+#include <linux/srcu.h>
 #include <linux/slab.h>
 
 #define __param(type, name, init, msg)		\
-- 
2.39.5
Re: [PATCH] lib/test_vmalloc.c: Fix compile error with CONFIG_TINY_RCU
Posted by Andrew Morton 9 months, 3 weeks ago
On Sun, 20 Apr 2025 16:20:29 +0200 "Uladzislau Rezki (Sony)" <urezki@gmail.com> wrote:

> When the kernel is built with CONFIG_TINY_RCU, compiling the
> test_vmalloc.c fails, due to conflicting definitions like
> "struct srcu_usage", etc. between "srcutiny.h" and "srcutree.h".
> 
> It happens because of direct including the "srcutree.h" bypassing
> the automatic selection mechanism. A correct approach is to include
> a generic <linux/srcu.h> which properly select SRCU implementation
> based on a kernel configuration.
> 
> Fix it by replacing the "srcutree.h" include with "srcu.h".
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504190717.tJHs381f-lkp@intel.com/
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

Thanks.

This is a fix against the mm-unstable patch "lib/test_vmalloc.c:
replace RWSEM to SRCU for setup".