Hi David, I love your patch! Perhaps something to improve: [auto build test WARNING on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/David-Howells/mm-Make-some-folio-and-page-function-arguments-const-and-use-bool/20221111-012958 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/166810136860.3462948.16794726061248137027.stgit%40warthog.procyon.org.uk patch subject: [PATCH] mm: Make some folio and page function arguments const and use bool config: m68k-allyesconfig compiler: m68k-linux-gcc (GCC) 12.1.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://github.com/intel-lab-lkp/linux/commit/3fb73cfd420034dbced68189dcfd7fb204a9018d git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review David-Howells/mm-Make-some-folio-and-page-function-arguments-const-and-use-bool/20221111-012958 git checkout 3fb73cfd420034dbced68189dcfd7fb204a9018d # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k prepare If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from include/linux/percpu.h:5, from include/linux/hrtimer.h:19, from include/linux/sched.h:20, from arch/m68k/kernel/asm-offsets.c:15: include/linux/page-flags.h: In function 'const_folio_flags': >> include/linux/page-flags.h:316:43: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:316:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:317:70: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:317:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ In file included from include/linux/thread_info.h:27, from include/asm-generic/preempt.h:5, from ./arch/m68k/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from arch/m68k/include/asm/irqflags.h:6, from include/linux/irqflags.h:16, from arch/m68k/include/asm/atomic.h:6, from include/linux/atomic.h:7, from include/linux/rcupdate.h:25, from include/linux/rculist.h:11, from include/linux/pid.h:5, from include/linux/sched.h:14: include/linux/page-flags.h: In function 'PageLocked': include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:365:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 365 | VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:257:34: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 257 | #define compound_head(page) ((typeof(page))_compound_head(page)) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:357:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 357 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:17: note: in expansion of macro 'PF_POISONED_CHECK' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:35: note: in expansion of macro 'compound_head' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:51:23: note: in definition of macro 'bitop' -- In file included from include/linux/percpu.h:5, from include/linux/percpu_counter.h:14, from include/linux/mm_types.h:21, from include/linux/buildid.h:5, from include/linux/module.h:14, from arch/m68k/kernel/ints.c:9: include/linux/page-flags.h: In function 'const_folio_flags': >> include/linux/page-flags.h:316:43: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:316:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:317:70: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:317:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ In file included from include/linux/thread_info.h:27, from include/asm-generic/preempt.h:5, from ./arch/m68k/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from arch/m68k/include/asm/irqflags.h:6, from include/linux/irqflags.h:16, from arch/m68k/include/asm/atomic.h:6, from include/linux/atomic.h:7, from include/linux/mm_types_task.h:13, from include/linux/mm_types.h:5: include/linux/page-flags.h: In function 'PageLocked': include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:365:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 365 | VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:257:34: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 257 | #define compound_head(page) ((typeof(page))_compound_head(page)) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:357:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 357 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:17: note: in expansion of macro 'PF_POISONED_CHECK' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:35: note: in expansion of macro 'compound_head' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:51:23: note: in definition of macro 'bitop' 51 | (uintptr_t)(addr) != (uintptr_t)NULL && \ | ^~~~ -- In file included from include/linux/percpu.h:5, from include/linux/hrtimer.h:19, from include/linux/sched.h:20, from arch/m68k/kernel/vectors.c:20: include/linux/page-flags.h: In function 'const_folio_flags': >> include/linux/page-flags.h:316:43: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:316:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 316 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:317:70: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~ include/linux/mmdebug.h:21:35: note: in definition of macro 'VM_BUG_ON_PAGE' 21 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ^~~~ include/linux/page-flags.h:317:9: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 317 | VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); | ^~~~~~~~~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ In file included from include/linux/thread_info.h:27, from include/asm-generic/preempt.h:5, from ./arch/m68k/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from arch/m68k/include/asm/irqflags.h:6, from include/linux/irqflags.h:16, from arch/m68k/include/asm/atomic.h:6, from include/linux/atomic.h:7, from include/linux/rcupdate.h:25, from include/linux/rculist.h:11, from include/linux/pid.h:5, from include/linux/sched.h:14: include/linux/page-flags.h: In function 'PageLocked': include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:365:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 365 | VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:257:34: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 257 | #define compound_head(page) ((typeof(page))_compound_head(page)) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:50:44: note: in definition of macro 'bitop' 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ | ^~~~ include/linux/page-flags.h:389:10: note: in expansion of macro 'test_bit' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~~~ include/linux/mmdebug.h:110:39: note: in expansion of macro 'VM_BUG_ON_PAGE' 110 | #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) | ^~~~~~~~~~~~~~ include/linux/page-flags.h:357:17: note: in expansion of macro 'VM_BUG_ON_PGFLAGS' 357 | VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \ | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:17: note: in expansion of macro 'PF_POISONED_CHECK' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:35: note: in expansion of macro 'compound_head' 366 | PF_POISONED_CHECK(compound_head(page)); }) | ^~~~~~~~~~~~~ include/linux/page-flags.h:389:32: note: in expansion of macro 'PF_NO_TAIL' 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~~~ include/linux/page-flags.h:439:9: note: in expansion of macro 'TESTPAGEFLAG' 439 | TESTPAGEFLAG(uname, lname, policy) \ | ^~~~~~~~~~~~ include/linux/page-flags.h:479:1: note: in expansion of macro '__PAGEFLAG' 479 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) | ^~~~~~~~~~ include/linux/mmdebug.h:12:29: note: expected 'struct page *' but argument is of type 'const struct page *' 12 | void dump_page(struct page *page, const char *reason); | ~~~~~~~~~~~~~^~~~ include/linux/page-flags.h:389:39: warning: passing argument 1 of 'dump_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 389 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | ^~~~ include/linux/bitops.h:51:23: note: in definition of macro 'bitop' .. vim +316 include/linux/page-flags.h 311 312 static const unsigned long *const_folio_flags(const struct folio *folio, unsigned n) 313 { 314 const struct page *page = &folio->page; 315 > 316 VM_BUG_ON_PGFLAGS(PageTail(page), page); 317 VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); 318 return &page[n].flags; 319 } 320 -- 0-DAY CI Kernel Test Service https://01.org/lkp