* [PATCH] mm: include swap.h in swapops.h
@ 2026-08-18 11:50 Kiryl Shutsemau
2026-08-19 5:26 ` Barry Song
2026-08-19 15:31 ` Lorenzo Stoakes (ARM)
0 siblings, 2 replies; 5+ messages in thread
From: Kiryl Shutsemau @ 2026-08-18 11:50 UTC (permalink / raw)
To: akpm, chrisl, kasong
Cc: ljs, shikemeng, nphamcs, baoquan.he, baohua, youngjun.park,
linux-mm, linux-kernel, Kiryl Shutsemau (Meta), kernel test robot
From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
all of which swap.h defines, but does not include swap.h. It compiles only
where the translation unit pulled swap.h in first. leafops.h includes
swapops.h on the line above swap.h, so a file whose include list reaches
leafops.h before swap.h gets:
In file included from include/linux/leafops.h:11:
include/linux/swapops.h:88:21: error: use of undeclared
identifier 'MAX_SWAPFILES_SHIFT'
A header that uses a definition has to include the header that provides it.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202608181757.mza9RRj7-lkp@intel.com/
Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
---
include/linux/swapops.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 1f3ff3b93e16..e7d0d529f3e0 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -5,6 +5,7 @@
#include <linux/radix-tree.h>
#include <linux/bug.h>
#include <linux/mm_types.h>
+#include <linux/swap.h>
#ifdef CONFIG_MMU
base-commit: 33f61b12d297562321533c048e034b1fb21c1cf3
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] mm: include swap.h in swapops.h
2026-08-18 11:50 [PATCH] mm: include swap.h in swapops.h Kiryl Shutsemau
@ 2026-08-19 5:26 ` Barry Song
2026-08-19 14:47 ` Kiryl Shutsemau
2026-08-19 15:31 ` Lorenzo Stoakes (ARM)
1 sibling, 1 reply; 5+ messages in thread
From: Barry Song @ 2026-08-19 5:26 UTC (permalink / raw)
To: Kiryl Shutsemau
Cc: akpm, chrisl, kasong, ljs, shikemeng, nphamcs, baoquan.he,
youngjun.park, linux-mm, linux-kernel, Kiryl Shutsemau (Meta),
kernel test robot
On Tue, Aug 18, 2026 at 7:50 PM Kiryl Shutsemau <kirill@shutemov.name> wrote:
>
> From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
>
> swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
> all of which swap.h defines, but does not include swap.h. It compiles only
> where the translation unit pulled swap.h in first. leafops.h includes
> swapops.h on the line above swap.h, so a file whose include list reaches
> leafops.h before swap.h gets:
>
> In file included from include/linux/leafops.h:11:
> include/linux/swapops.h:88:21: error: use of undeclared
> identifier 'MAX_SWAPFILES_SHIFT'
>
> A header that uses a definition has to include the header that provides it.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202608181757.mza9RRj7-lkp@intel.com/
> Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> ---
Basically, is this preparing for the patchset below?
https://lore.kernel.org/linux-mm/20260816224609.308019-1-kirill@shutemov.name/
Reviewed-by: Barry Song <baohua@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: include swap.h in swapops.h
2026-08-19 5:26 ` Barry Song
@ 2026-08-19 14:47 ` Kiryl Shutsemau
2026-08-19 15:32 ` Lorenzo Stoakes (ARM)
0 siblings, 1 reply; 5+ messages in thread
From: Kiryl Shutsemau @ 2026-08-19 14:47 UTC (permalink / raw)
To: Barry Song
Cc: akpm, chrisl, kasong, ljs, shikemeng, nphamcs, baoquan.he,
youngjun.park, linux-mm, linux-kernel, kernel test robot
On Wed, Aug 19, 2026 at 01:26:07PM +0800, Barry Song wrote:
> On Tue, Aug 18, 2026 at 7:50 PM Kiryl Shutsemau <kirill@shutemov.name> wrote:
> >
> > From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
> >
> > swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
> > all of which swap.h defines, but does not include swap.h. It compiles only
> > where the translation unit pulled swap.h in first. leafops.h includes
> > swapops.h on the line above swap.h, so a file whose include list reaches
> > leafops.h before swap.h gets:
> >
> > In file included from include/linux/leafops.h:11:
> > include/linux/swapops.h:88:21: error: use of undeclared
> > identifier 'MAX_SWAPFILES_SHIFT'
> >
> > A header that uses a definition has to include the header that provides it.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202608181757.mza9RRj7-lkp@intel.com/
> > Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> > ---
>
> Basically, is this preparing for the patchset below?
>
> https://lore.kernel.org/linux-mm/20260816224609.308019-1-kirill@shutemov.name/
My patchset just triggered inert bug.
> Reviewed-by: Barry Song <baohua@kernel.org>
Thanks!
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: include swap.h in swapops.h
2026-08-19 14:47 ` Kiryl Shutsemau
@ 2026-08-19 15:32 ` Lorenzo Stoakes (ARM)
0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-19 15:32 UTC (permalink / raw)
To: Kiryl Shutsemau
Cc: Barry Song, akpm, chrisl, kasong, shikemeng, nphamcs, baoquan.he,
youngjun.park, linux-mm, linux-kernel, kernel test robot
On Wed, Aug 19, 2026 at 03:47:33PM +0100, Kiryl Shutsemau wrote:
> On Wed, Aug 19, 2026 at 01:26:07PM +0800, Barry Song wrote:
> > On Tue, Aug 18, 2026 at 7:50 PM Kiryl Shutsemau <kirill@shutemov.name> wrote:
> > >
> > > From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
> > >
> > > swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
> > > all of which swap.h defines, but does not include swap.h. It compiles only
> > > where the translation unit pulled swap.h in first. leafops.h includes
> > > swapops.h on the line above swap.h, so a file whose include list reaches
> > > leafops.h before swap.h gets:
> > >
> > > In file included from include/linux/leafops.h:11:
> > > include/linux/swapops.h:88:21: error: use of undeclared
> > > identifier 'MAX_SWAPFILES_SHIFT'
> > >
> > > A header that uses a definition has to include the header that provides it.
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202608181757.mza9RRj7-lkp@intel.com/
> > > Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> > > ---
> >
> > Basically, is this preparing for the patchset below?
> >
> > https://lore.kernel.org/linux-mm/20260816224609.308019-1-kirill@shutemov.name/
>
> My patchset just triggered inert bug.
>
> > Reviewed-by: Barry Song <baohua@kernel.org>
>
> Thanks!
>
> --
> Kiryl Shutsemau / Kirill A. Shutemov
Yeah, see my reply, but this is more like 'Lorenzo's unfinished work and a
mistake in his includes' :)
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: include swap.h in swapops.h
2026-08-18 11:50 [PATCH] mm: include swap.h in swapops.h Kiryl Shutsemau
2026-08-19 5:26 ` Barry Song
@ 2026-08-19 15:31 ` Lorenzo Stoakes (ARM)
1 sibling, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-19 15:31 UTC (permalink / raw)
To: Kiryl Shutsemau
Cc: akpm, chrisl, kasong, shikemeng, nphamcs, baoquan.he, baohua,
youngjun.park, linux-mm, linux-kernel, Kiryl Shutsemau (Meta),
kernel test robot
On Tue, Aug 18, 2026 at 12:50:26PM +0100, Kiryl Shutsemau wrote:
> From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
>
> swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
> all of which swap.h defines, but does not include swap.h. It compiles only
> where the translation unit pulled swap.h in first. leafops.h includes
> swapops.h on the line above swap.h, so a file whose include list reaches
> leafops.h before swap.h gets:
>
> In file included from include/linux/leafops.h:11:
> include/linux/swapops.h:88:21: error: use of undeclared
> identifier 'MAX_SWAPFILES_SHIFT'
>
> A header that uses a definition has to include the header that provides it.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202608181757.mza9RRj7-lkp@intel.com/
> Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Ah C headers are terrible :)
I see that the common pattern is:
#include <swap.h>
#include <swapops.h>
Which is already itself quite horrible, though I suppose intent was to
separate out stuff between the two and to not require that people take
swapops.h necessarily.
Anyway swapops.h needs to be removed, it's a left-over from the
not-quite-fully-complete softleaf work (I left some of the swap
entry-specific stuff alone).
But when that's done by me or whoever else, the resolution should be that
swapops.h is deleted with everything there that needs to be kept around
moved -> leafops since swap entries are just another softleaf type.
Anyway I can fix the broader issue when I get rid of swapops.h, so this
LGTM as a resolution for the time being and:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> include/linux/swapops.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/swapops.h b/include/linux/swapops.h
> index 1f3ff3b93e16..e7d0d529f3e0 100644
> --- a/include/linux/swapops.h
> +++ b/include/linux/swapops.h
> @@ -5,6 +5,7 @@
> #include <linux/radix-tree.h>
> #include <linux/bug.h>
> #include <linux/mm_types.h>
> +#include <linux/swap.h>
>
> #ifdef CONFIG_MMU
>
>
> base-commit: 33f61b12d297562321533c048e034b1fb21c1cf3
> --
> 2.54.0
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-19 15:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 11:50 [PATCH] mm: include swap.h in swapops.h Kiryl Shutsemau
2026-08-19 5:26 ` Barry Song
2026-08-19 14:47 ` Kiryl Shutsemau
2026-08-19 15:32 ` Lorenzo Stoakes (ARM)
2026-08-19 15:31 ` Lorenzo Stoakes (ARM)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.