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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 20 Jun 2022 16:42:46 +1000

Hi all,

After merging the mm tree, today's linux-next build (x86_64 allnoconfig)
failed like this:

In file included from arch/x86/include/asm/page.h:86,
                 from arch/x86/include/asm/thread_info.h:12,
                 from include/linux/thread_info.h:60,
                 from arch/x86/include/asm/preempt.h:7,
                 from include/linux/preempt.h:78,
                 from include/linux/spinlock.h:55,
                 from include/linux/mmzone.h:8,
                 from include/linux/gfp.h:6,
                 from include/linux/slab.h:15,
                 from include/linux/crypto.h:20,
                 from arch/x86/kernel/asm-offsets.c:9:
include/linux/mm.h: In function 'destroy_large_folio':
include/asm-generic/memory_model.h:35:21: error: implicit declaration of function 'page_to_section'; did you mean 'present_section'? [-Werror=implicit-function-declaration]
   35 |         int __sec = page_to_section(__pg);                      \
      |                     ^~~~~~~~~~~~~~~
include/asm-generic/memory_model.h:40:32: note: in definition of macro '__pfn_to_page'
   40 | ({      unsigned long __pfn = (pfn);                    \
      |                                ^~~
include/asm-generic/memory_model.h:52:21: note: in expansion of macro '__page_to_pfn'
   52 | #define page_to_pfn __page_to_pfn
      |                     ^~~~~~~~~~~~~
include/linux/mm.h:214:38: note: in expansion of macro 'page_to_pfn'
  214 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
      |                                      ^~~~~~~~~~~
include/linux/page-flags.h:312:33: note: in expansion of macro 'nth_page'
  312 | #define folio_page(folio, n)    nth_page(&(folio)->page, n)
      |                                 ^~~~~~~~
include/linux/mm.h:928:38: note: in expansion of macro 'folio_page'
  928 |         enum compound_dtor_id dtor = folio_page(folio, 1)->compound_dtor;
      |                                      ^~~~~~~~~~
In file included from include/linux/memcontrol.h:20,
                 from include/linux/swap.h:9,
                 from include/linux/suspend.h:5,
                 from arch/x86/kernel/asm-offsets.c:13:
include/linux/mm.h: At top level:
include/linux/mm.h:1556:29: error: conflicting types for 'page_to_section'; have 'long unsigned int(const struct page *)'
 1556 | static inline unsigned long page_to_section(const struct page *page)
      |                             ^~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/page.h:86,
                 from arch/x86/include/asm/thread_info.h:12,
                 from include/linux/thread_info.h:60,
                 from arch/x86/include/asm/preempt.h:7,
                 from include/linux/preempt.h:78,
                 from include/linux/spinlock.h:55,
                 from include/linux/mmzone.h:8,
                 from include/linux/gfp.h:6,
                 from include/linux/slab.h:15,
                 from include/linux/crypto.h:20,
                 from arch/x86/kernel/asm-offsets.c:9:
include/asm-generic/memory_model.h:35:21: note: previous implicit declaration of 'page_to_section' with type 'int()'
   35 |         int __sec = page_to_section(__pg);                      \
      |                     ^~~~~~~~~~~~~~~
include/asm-generic/memory_model.h:40:32: note: in definition of macro '__pfn_to_page'
   40 | ({      unsigned long __pfn = (pfn);                    \
      |                                ^~~
include/asm-generic/memory_model.h:52:21: note: in expansion of macro '__page_to_pfn'
   52 | #define page_to_pfn __page_to_pfn
      |                     ^~~~~~~~~~~~~
include/linux/mm.h:214:38: note: in expansion of macro 'page_to_pfn'
  214 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
      |                                      ^~~~~~~~~~~
include/linux/page-flags.h:312:33: note: in expansion of macro 'nth_page'
  312 | #define folio_page(folio, n)    nth_page(&(folio)->page, n)
      |                                 ^~~~~~~~
include/linux/mm.h:928:38: note: in expansion of macro 'folio_page'
  928 |         enum compound_dtor_id dtor = folio_page(folio, 1)->compound_dtor;
      |                                      ^~~~~~~~~~
cc1: some warnings being treated as errors

Caused by commit (I think)

  d3b90b76e101 ("mm: convert destroy_compound_page() to destroy_large_folio()")

I have reverted these commits fot today:

56629699b3dd mm/swap: convert __delete_from_swap_cache() to a folio
e5085f2cc241 mm/swap: convert delete_from_swap_cache() to take a folio
169f02f4efb1 mm: convert page_swap_flags to folio_swap_flags
d3b90b76e101 mm: convert destroy_compound_page() to destroy_large_folio()

Then I got:

mm/hugetlb_vmemmap.c: In function 'vmemmap_optimizable_pages':
mm/hugetlb_vmemmap.c:110:24: error: implicit declaration of function 'sparse_decode_mem_map' [-Werror=implicit-function-declaration]
  110 |         vmemmap_page = sparse_decode_mem_map(ms->section_mem_map,
      |                        ^~~~~~~~~~~~~~~~~~~~~
mm/hugetlb_vmemmap.c:110:22: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  110 |         vmemmap_page = _sparsedecode_mem_map(ms->section_mem_map,
      |                      ^
cc1: some warnings being treated as errors

from my arm64 defconfig build.

Caused by commit

  10a768735470 ("mm: memory_hotplug: make hugetlb_optimize_vmemmap compatible with memmap_on_memory")

So I gave up and used the mm tree from next-20220617 for today.
-- 
Cheers,
Stephen Rothwell