* [PATCH] Fix the problem that kunit cannot run
@ 2025-10-27 9:12 bajing
2025-10-27 23:35 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: bajing @ 2025-10-27 9:12 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, bajing
When running ./tools/testing/kunit/kunit.py run,the error for mm/swap.h
is as follows:
ERROR:root:In file included from ../mm/shmem.c:43:
../mm/swap.h: In function ‘non_swapcache_batch’:
../mm/swap.h:66:19: error: implicit declaration of function ‘swp_offset’;
did you mean ‘pud_offset’? [-Werror=implicit-function-declaration]
66 | pgoff_t offset = swp_offset(entry);
| ^~~~~~~~~~
| pud_offset
In file included from ../mm/shmem.c:68:
../include/linux/swapops.h: At top level:
../include/linux/swapops.h:107:23: error: conflicting types for ‘swp_offset’
107 | static inline pgoff_t swp_offset(swp_entry_t entry)
| ^~~~~~~~~~
In file included from ../mm/shmem.c:43:
../mm/swap.h:66:19: note: previous implicit declaration of ‘swp_offset’ was here
66 | pgoff_t offset = swp_offset(entry);
| ^~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [../scripts/Makefile.build:243: mm/shmem.o] Error 1
make[3]: *** [../scripts/Makefile.build:480: mm] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/home/openeuler/kernel/Makefile:1924: .] Error 2
make[1]: *** [/home/openeuler/kernel/Makefile:234: __sub-make] Error 2
make: *** [Makefile:234: __sub-make] Error 2
Signed-off-by: bajing <bajing@cmss.chinamobile.com>
---
mm/swap.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/swap.h b/mm/swap.h
index 26fa536a8947..04695e1af068 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -4,6 +4,7 @@
#ifdef CONFIG_SWAP
#include <linux/blk_types.h> /* for bio_end_io_t */
+#include <linux/swapops.h>
/* linux/mm/page_io.c */
int sio_pool_init(void);
--
2.50.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Fix the problem that kunit cannot run
2025-10-27 9:12 [PATCH] Fix the problem that kunit cannot run bajing
@ 2025-10-27 23:35 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2025-10-27 23:35 UTC (permalink / raw)
To: bajing; +Cc: linux-mm, linux-kernel
On Mon, 27 Oct 2025 17:12:30 +0800 bajing <bajing@cmss.chinamobile.com> wrote:
> When running ./tools/testing/kunit/kunit.py run,the error for mm/swap.h
> is as follows:
> ERROR:root:In file included from ../mm/shmem.c:43:
> ../mm/swap.h: In function ‘non_swapcache_batch’:
> ../mm/swap.h:66:19: error: implicit declaration of function ‘swp_offset’;
> did you mean ‘pud_offset’? [-Werror=implicit-function-declaration]
> 66 | pgoff_t offset = swp_offset(entry);
> | ^~~~~~~~~~
> | pud_offset
> In file included from ../mm/shmem.c:68:
> ../include/linux/swapops.h: At top level:
> ../include/linux/swapops.h:107:23: error: conflicting types for ‘swp_offset’
> 107 | static inline pgoff_t swp_offset(swp_entry_t entry)
> | ^~~~~~~~~~
> In file included from ../mm/shmem.c:43:
> ../mm/swap.h:66:19: note: previous implicit declaration of ‘swp_offset’ was here
> 66 | pgoff_t offset = swp_offset(entry);
> | ^~~~~~~~~~
> cc1: some warnings being treated as errors
> make[4]: *** [../scripts/Makefile.build:243: mm/shmem.o] Error 1
> make[3]: *** [../scripts/Makefile.build:480: mm] Error 2
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [/home/openeuler/kernel/Makefile:1924: .] Error 2
> make[1]: *** [/home/openeuler/kernel/Makefile:234: __sub-make] Error 2
> make: *** [Makefile:234: __sub-make] Error 2
>
> ...
>
> --- a/mm/swap.h
> +++ b/mm/swap.h
> @@ -4,6 +4,7 @@
>
> #ifdef CONFIG_SWAP
> #include <linux/blk_types.h> /* for bio_end_io_t */
> +#include <linux/swapops.h>
>
> /* linux/mm/page_io.c */
> int sio_pool_init(void);
Thanks, but I suspect you're using an older kernel. 6.18-rc3 doesn't
look like the above and it already has
: #ifdef CONFIG_SWAP
: #include <linux/swapops.h> /* for swp_offset */
: #include <linux/blk_types.h> /* for bio_end_io_t */
:
: static inline unsigned int swp_cluster_offset(swp_entry_t entry)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-27 23:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-27 9:12 [PATCH] Fix the problem that kunit cannot run bajing
2025-10-27 23:35 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox