[willy-pagecache:for-next 13/75] include/linux/mm.h:1570:29: error: conflicting types for 'page_to_section'; have 'long unsigned int(const struct page *)'

From: kernel test robot
Date: Fri Feb 04 2022 - 17:55:04 EST


tree: git://git.infradead.org/users/willy/pagecache for-next
head: 0416a53bea174a256c555e1662abb917077a528c
commit: 8788d4b404865697ebe822cff65a1380728ba251 [13/75] mm: Add folio_pincount_ptr()
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20220205/202202050617.Ew48ldTc-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.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
git remote add willy-pagecache git://git.infradead.org/users/willy/pagecache
git fetch --no-tags willy-pagecache for-next
git checkout 8788d4b404865697ebe822cff65a1380728ba251
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha prepare

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

All errors (new ones prefixed by >>):

In file included from arch/alpha/include/asm/page.h:94,
from include/linux/shm.h:6,
from include/linux/sched.h:16,
from arch/alpha/kernel/asm-offsets.c:10:
include/linux/mm.h: In function 'folio_pincount_ptr':
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:218:38: note: in expansion of macro 'page_to_pfn'
218 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
| ^~~~~~~~~~~
include/linux/page-flags.h:230:33: note: in expansion of macro 'nth_page'
230 | #define folio_page(folio, n) nth_page(&(folio)->page, n)
| ^~~~~~~~
include/linux/mm.h:896:17: note: in expansion of macro 'folio_page'
896 | return &folio_page(folio, 1)->compound_pincount;
| ^~~~~~~~~~
In file included from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/alpha/kernel/asm-offsets.c:11:
include/linux/mm.h: At top level:
>> include/linux/mm.h:1570:29: error: conflicting types for 'page_to_section'; have 'long unsigned int(const struct page *)'
1570 | static inline unsigned long page_to_section(const struct page *page)
| ^~~~~~~~~~~~~~~
In file included from arch/alpha/include/asm/page.h:94,
from include/linux/shm.h:6,
from include/linux/sched.h:16,
from arch/alpha/kernel/asm-offsets.c:10:
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:218:38: note: in expansion of macro 'page_to_pfn'
218 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
| ^~~~~~~~~~~
include/linux/page-flags.h:230:33: note: in expansion of macro 'nth_page'
230 | #define folio_page(folio, n) nth_page(&(folio)->page, n)
| ^~~~~~~~
include/linux/mm.h:896:17: note: in expansion of macro 'folio_page'
896 | return &folio_page(folio, 1)->compound_pincount;
| ^~~~~~~~~~
arch/alpha/kernel/asm-offsets.c:15:6: warning: no previous prototype for 'foo' [-Wmissing-prototypes]
15 | void foo(void)
| ^~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:121: arch/alpha/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1191: 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 +1570 include/linux/mm.h

bf4e8902ee5080 Daniel Kiper 2011-05-24 1569
aa462abe8aaf21 Ian Campbell 2011-08-17 @1570 static inline unsigned long page_to_section(const struct page *page)
d41dee369bff3b Andy Whitcroft 2005-06-23 1571 {
d41dee369bff3b Andy Whitcroft 2005-06-23 1572 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
d41dee369bff3b Andy Whitcroft 2005-06-23 1573 }
308c05e35e3517 Christoph Lameter 2008-04-28 1574 #endif
d41dee369bff3b Andy Whitcroft 2005-06-23 1575

:::::: The code at line 1570 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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx