Re: [PATCH] mm/slab: Add a __GFP_ACCOUNT GFP flag check for slab allocation

From: kernel test robot
Date: Sun Jun 14 2020 - 06:29:42 EST


Hi Muchun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mmotm/master]

url: https://github.com/0day-ci/linux/commits/Muchun-Song/mm-slab-Add-a-__GFP_ACCOUNT-GFP-flag-check-for-slab-allocation/20200614-144049
base: git://git.cmpxchg.org/linux-mmotm.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/kernel.h:11,
from include/linux/interrupt.h:6,
from mm/kasan/common.c:18:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
| ^~~~~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/linux/mm_types_task.h:16,
from include/linux/mm_types.h:5,
from include/linux/mmzone.h:21,
from include/linux/topology.h:33,
from include/linux/irq.h:19,
from include/asm-generic/hardirq.h:13,
from ./arch/xtensa/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:9,
from include/linux/interrupt.h:11,
from mm/kasan/common.c:18:
mm/kasan/../internal.h: In function 'mem_map_next':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
>> mm/kasan/../internal.h:393:8: note: in expansion of macro 'pfn_valid'
393 | if (!pfn_valid(pfn))
| ^~~~~~~~~
--
In file included from arch/xtensa/include/asm/processor.h:15,
from arch/xtensa/include/asm/bitops.h:20,
from include/linux/bitops.h:19,
from mm/kasan/report.c:17:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
| ^~~~~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/linux/mm_types_task.h:16,
from include/linux/mm_types.h:5,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/mm.h:10,
from include/linux/kallsyms.h:12,
from include/linux/ftrace.h:11,
from mm/kasan/report.c:18:
mm/kasan/../internal.h: In function 'mem_map_next':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
>> mm/kasan/../internal.h:393:8: note: in expansion of macro 'pfn_valid'
393 | if (!pfn_valid(pfn))
| ^~~~~~~~~
mm/kasan/report.c: At top level:
mm/kasan/report.c:474:6: warning: no previous prototype for '__kasan_report' [-Wmissing-prototypes]
474 | void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
| ^~~~~~~~~~~~~~
--
In file included from arch/xtensa/include/asm/processor.h:15,
from arch/xtensa/include/asm/bitops.h:20,
from include/linux/bitops.h:19,
from mm/kasan/generic_report.c:17:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
| ^~~~~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from include/linux/mm_types_task.h:16,
from include/linux/mm_types.h:5,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/mm.h:10,
from include/linux/kallsyms.h:12,
from include/linux/ftrace.h:11,
from mm/kasan/generic_report.c:18:
mm/kasan/../internal.h: In function 'mem_map_next':
arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
182 | ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
| ^~
>> mm/kasan/../internal.h:393:8: note: in expansion of macro 'pfn_valid'
393 | if (!pfn_valid(pfn))
| ^~~~~~~~~
mm/kasan/generic_report.c: At top level:
mm/kasan/generic_report.c:116:6: warning: no previous prototype for '__asan_report_load1_noabort' [-Wmissing-prototypes]
116 | void __asan_report_load##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:129:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
129 | DEFINE_ASAN_REPORT_LOAD(1);
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:116:6: warning: no previous prototype for '__asan_report_load2_noabort' [-Wmissing-prototypes]
116 | void __asan_report_load##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:130:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
130 | DEFINE_ASAN_REPORT_LOAD(2);
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:116:6: warning: no previous prototype for '__asan_report_load4_noabort' [-Wmissing-prototypes]
116 | void __asan_report_load##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:131:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
131 | DEFINE_ASAN_REPORT_LOAD(4);
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:116:6: warning: no previous prototype for '__asan_report_load8_noabort' [-Wmissing-prototypes]
116 | void __asan_report_load##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:132:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
132 | DEFINE_ASAN_REPORT_LOAD(8);
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:116:6: warning: no previous prototype for '__asan_report_load16_noabort' [-Wmissing-prototypes]
116 | void __asan_report_load##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:133:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
133 | DEFINE_ASAN_REPORT_LOAD(16);
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:123:6: warning: no previous prototype for '__asan_report_store1_noabort' [-Wmissing-prototypes]
123 | void __asan_report_store##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:134:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
134 | DEFINE_ASAN_REPORT_STORE(1);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:123:6: warning: no previous prototype for '__asan_report_store2_noabort' [-Wmissing-prototypes]
123 | void __asan_report_store##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:135:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
135 | DEFINE_ASAN_REPORT_STORE(2);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:123:6: warning: no previous prototype for '__asan_report_store4_noabort' [-Wmissing-prototypes]
123 | void __asan_report_store##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:136:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
136 | DEFINE_ASAN_REPORT_STORE(4);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:123:6: warning: no previous prototype for '__asan_report_store8_noabort' [-Wmissing-prototypes]
123 | void __asan_report_store##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:137:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
137 | DEFINE_ASAN_REPORT_STORE(8);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:123:6: warning: no previous prototype for '__asan_report_store16_noabort' [-Wmissing-prototypes]
123 | void __asan_report_store##size##_noabort(unsigned long addr) | ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:138:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
138 | DEFINE_ASAN_REPORT_STORE(16);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:140:6: warning: no previous prototype for '__asan_report_load_n_noabort' [-Wmissing-prototypes]
140 | void __asan_report_load_n_noabort(unsigned long addr, size_t size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:146:6: warning: no previous prototype for '__asan_report_store_n_noabort' [-Wmissing-prototypes]
146 | void __asan_report_store_n_noabort(unsigned long addr, size_t size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/pfn_valid +393 mm/kasan/../internal.h

69d177c2fc702d Andy Whitcroft 2008-11-06 383
69d177c2fc702d Andy Whitcroft 2008-11-06 384 /*
25985edcedea63 Lucas De Marchi 2011-03-30 385 * Iterator over all subpages within the maximally aligned gigantic
69d177c2fc702d Andy Whitcroft 2008-11-06 386 * page 'base'. Handle any discontiguity in the mem_map.
69d177c2fc702d Andy Whitcroft 2008-11-06 387 */
69d177c2fc702d Andy Whitcroft 2008-11-06 388 static inline struct page *mem_map_next(struct page *iter,
69d177c2fc702d Andy Whitcroft 2008-11-06 389 struct page *base, int offset)
69d177c2fc702d Andy Whitcroft 2008-11-06 390 {
69d177c2fc702d Andy Whitcroft 2008-11-06 391 if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) == 0)) {
69d177c2fc702d Andy Whitcroft 2008-11-06 392 unsigned long pfn = page_to_pfn(base) + offset;
69d177c2fc702d Andy Whitcroft 2008-11-06 @393 if (!pfn_valid(pfn))
69d177c2fc702d Andy Whitcroft 2008-11-06 394 return NULL;
69d177c2fc702d Andy Whitcroft 2008-11-06 395 return pfn_to_page(pfn);
69d177c2fc702d Andy Whitcroft 2008-11-06 396 }
69d177c2fc702d Andy Whitcroft 2008-11-06 397 return iter + 1;
69d177c2fc702d Andy Whitcroft 2008-11-06 398 }
69d177c2fc702d Andy Whitcroft 2008-11-06 399

:::::: The code at line 393 was first introduced by commit
:::::: 69d177c2fc702d402b17fdca2190d5a7e3ca55c5 hugetlbfs: handle pages higher order than MAX_ORDER

:::::: TO: Andy Whitcroft <apw@xxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip