[akpm-mm:mm-unstable 255/261] include/linux/mm.h:1556:29: error: conflicting types for 'page_to_section'; have 'long unsigned int(const struct page *)'

From: kernel test robot
Date: Sat Jun 18 2022 - 03:01:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head: 882be1ed6b1b5073fc88552181b99bd2b9c0031f
commit: d3b90b76e1013bb7e201bcccf5f5433f322f2123 [255/261] mm: convert destroy_compound_page() to destroy_large_folio()
config: parisc64-defconfig (https://download.01.org/0day-ci/archive/20220618/202206181437.AwvGIkuq-lkp@xxxxxxxxx/config)
compiler: hppa64-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?id=d3b90b76e1013bb7e201bcccf5f5433f322f2123
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch --no-tags akpm-mm mm-unstable
git checkout d3b90b76e1013bb7e201bcccf5f5433f322f2123
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=parisc64 prepare

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from arch/parisc/include/asm/page.h:185,
from include/linux/shm.h:6,
from include/linux/sched.h:16,
from arch/parisc/kernel/asm-offsets.c:18:
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:307:33: note: in expansion of macro 'nth_page'
307 | #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/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/parisc/kernel/asm-offsets.c:20:
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/parisc/include/asm/page.h:185,
from include/linux/shm.h:6,
from include/linux/sched.h:16,
from arch/parisc/kernel/asm-offsets.c:18:
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:307:33: note: in expansion of macro 'nth_page'
307 | #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
make[2]: *** [scripts/Makefile.build:117: arch/parisc/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +1556 include/linux/mm.h

bf4e8902ee5080 Daniel Kiper 2011-05-24 1555
aa462abe8aaf21 Ian Campbell 2011-08-17 @1556 static inline unsigned long page_to_section(const struct page *page)
d41dee369bff3b Andy Whitcroft 2005-06-23 1557 {
d41dee369bff3b Andy Whitcroft 2005-06-23 1558 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
d41dee369bff3b Andy Whitcroft 2005-06-23 1559 }
308c05e35e3517 Christoph Lameter 2008-04-28 1560 #endif
d41dee369bff3b Andy Whitcroft 2005-06-23 1561

:::::: The code at line 1556 was first introduced by commit
:::::: aa462abe8aaf2198d6aef97da20c874ac694a39f mm: fix __page_to_pfn for a const struct page argument

:::::: TO: Ian Campbell <ian.campbell@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp