2022-07-21 10:16:41

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warning after merge of the mm tree

Hi all,

After merging the mm tree, today's linux-next build (powerpc
ppc64_defconfig) produced this warning:

In file included from arch/powerpc/include/asm/book3s/64/mmu-hash.h:20,
from arch/powerpc/include/asm/book3s/64/mmu.h:32,
from arch/powerpc/include/asm/mmu.h:393,
from arch/powerpc/include/asm/lppaca.h:46,
from arch/powerpc/include/asm/paca.h:18,
from arch/powerpc/include/asm/current.h:13,
from include/linux/thread_info.h:23,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:55,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/khugepaged.c:4:
arch/powerpc/include/asm/book3s/64/pgtable.h:190:25: warning: "__pte_index_size" is not defined, evaluates to 0 [-Wundef]
190 | #define PTE_INDEX_SIZE __pte_index_size
| ^~~~~~~~~~~~~~~~
arch/powerpc/include/asm/book3s/64/pgtable.h:241:39: note: in expansion of macro 'PTE_INDEX_SIZE'
241 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
| ^~~~~~~~~~~~~~
include/linux/huge_mm.h:109:25: note: in expansion of macro 'PMD_SHIFT'
109 | #define HPAGE_PMD_SHIFT PMD_SHIFT
| ^~~~~~~~~
include/linux/huge_mm.h:105:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
| ^~~~~~~~~~~~~~~
mm/khugepaged.c:95:5: note: in expansion of macro 'HPAGE_PMD_ORDER'
95 | #if HPAGE_PMD_ORDER < 16
| ^~~~~~~~~~~~~~~

Introduced by commit

adcc4e193b6b ("mm/khugepaged: use minimal bits to store num page < HPAGE_PMD_NR")

So HPAGE_PMD_ORDER is not a constant on ppc64 ...

I applied this hack for today (which makes it build without warning and
puts things more or less back as they were for ppo64).

From: Stephen Rothwell <[email protected]>
Date: Thu, 21 Jul 2022 19:49:40 +1000
Subject: [PATCH] fix up for "mm/khugepaged: use minimal bits to store num page < HPAGE_PMD_NR"

Signed-off-by: Stephen Rothwell <[email protected]>
---
mm/khugepaged.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 28cb8429dad4..d8e388106322 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -92,7 +92,9 @@ struct collapse_control {
bool is_khugepaged;

/* Num pages scanned per node */
-#if HPAGE_PMD_ORDER < 16
+#if defined(CONFIG_PPC64)
+ u32 node_load[MAX_NUMNODES];
+#elif HPAGE_PMD_ORDER < 16
u16 node_load[MAX_NUMNODES];
#else
u32 node_load[MAX_NUMNODES];
--
2.35.1

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-07-21 11:42:10

by Zach O'Keefe

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the mm tree

On Jul 21 19:55, Stephen Rothwell wrote:
> Hi all,
>
> After merging the mm tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
>
> In file included from arch/powerpc/include/asm/book3s/64/mmu-hash.h:20,
> from arch/powerpc/include/asm/book3s/64/mmu.h:32,
> from arch/powerpc/include/asm/mmu.h:393,
> from arch/powerpc/include/asm/lppaca.h:46,
> from arch/powerpc/include/asm/paca.h:18,
> from arch/powerpc/include/asm/current.h:13,
> from include/linux/thread_info.h:23,
> from include/asm-generic/preempt.h:5,
> from ./arch/powerpc/include/generated/asm/preempt.h:1,
> from include/linux/preempt.h:78,
> from include/linux/spinlock.h:55,
> from include/linux/mmzone.h:8,
> from include/linux/gfp.h:7,
> from include/linux/mm.h:7,
> from mm/khugepaged.c:4:
> arch/powerpc/include/asm/book3s/64/pgtable.h:190:25: warning: "__pte_index_size" is not defined, evaluates to 0 [-Wundef]
> 190 | #define PTE_INDEX_SIZE __pte_index_size
> | ^~~~~~~~~~~~~~~~
> arch/powerpc/include/asm/book3s/64/pgtable.h:241:39: note: in expansion of macro 'PTE_INDEX_SIZE'
> 241 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
> | ^~~~~~~~~~~~~~
> include/linux/huge_mm.h:109:25: note: in expansion of macro 'PMD_SHIFT'
> 109 | #define HPAGE_PMD_SHIFT PMD_SHIFT
> | ^~~~~~~~~
> include/linux/huge_mm.h:105:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
> 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
> | ^~~~~~~~~~~~~~~
> mm/khugepaged.c:95:5: note: in expansion of macro 'HPAGE_PMD_ORDER'
> 95 | #if HPAGE_PMD_ORDER < 16
> | ^~~~~~~~~~~~~~~
>
> Introduced by commit
>
> adcc4e193b6b ("mm/khugepaged: use minimal bits to store num page < HPAGE_PMD_NR")
>
> So HPAGE_PMD_ORDER is not a constant on ppc64 ...
>
> I applied this hack for today (which makes it build without warning and
> puts things more or less back as they were for ppo64).
>
> From: Stephen Rothwell <[email protected]>
> Date: Thu, 21 Jul 2022 19:49:40 +1000
> Subject: [PATCH] fix up for "mm/khugepaged: use minimal bits to store num page < HPAGE_PMD_NR"
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> mm/khugepaged.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 28cb8429dad4..d8e388106322 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -92,7 +92,9 @@ struct collapse_control {
> bool is_khugepaged;
>
> /* Num pages scanned per node */
> -#if HPAGE_PMD_ORDER < 16
> +#if defined(CONFIG_PPC64)
> + u32 node_load[MAX_NUMNODES];
> +#elif HPAGE_PMD_ORDER < 16
> u16 node_load[MAX_NUMNODES];
> #else
> u32 node_load[MAX_NUMNODES];
> --
> 2.35.1
>
> --
> Cheers,
> Stephen Rothwell

Thanks Stephen, and apologies here. I thought I had taken a look at all archs
(just inspection, I didn't attempt to build them all) - but seems like I missed
this one..

I'm fine with the change, though I could see the argument that this is getting a
little complicated to save what is likely a few bits in the common case.
Appreciate the fix.

Reviewed-by: Zach O'Keefe <[email protected]>

Best,
Zach