Subject: linux-next: build warning after merge of the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 21 Jul 2022 19:55:08 +1000

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-masked]>
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-masked]>
---
 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