linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: bajing <bajing@cmss.chinamobile.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix the problem that kunit cannot run
Date: Mon, 27 Oct 2025 16:35:43 -0700	[thread overview]
Message-ID: <20251027163543.bbf0f6bf9f81c3a61afa48a2@linux-foundation.org> (raw)
In-Reply-To: <20251027091231.1770-1-bajing@cmss.chinamobile.com>

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)



      reply	other threads:[~2025-10-27 23:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27  9:12 bajing
2025-10-27 23:35 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251027163543.bbf0f6bf9f81c3a61afa48a2@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bajing@cmss.chinamobile.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox