Hi David, I love your patch! Yet something to improve: [auto build test ERROR 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: x86_64-randconfig-a016 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) 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=clang make.cross W=1 O=build_dir ARCH=x86_64 prepare If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:316:36: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] VM_BUG_ON_PGFLAGS(PageTail(page), page); ^~~~ include/linux/mmdebug.h:110:60: note: expanded from macro 'VM_BUG_ON_PGFLAGS' #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) ^~~~ include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:317:63: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); ^~~~ include/linux/mmdebug.h:110:60: note: expanded from macro 'VM_BUG_ON_PGFLAGS' #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) ^~~~ include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:479:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:439:2: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:365:48: note: expanded from macro 'PF_NO_TAIL' VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:50:37: note: expanded from macro 'bitop' __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:479:28: error: passing 'typeof (page)' (aka 'const struct page *') to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/page-flags.h:439:29: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/linux/page-flags.h:389:32: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:21: note: expanded from macro 'PF_NO_TAIL' PF_POISONED_CHECK(compound_head(page)); }) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ~~~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/bitops.h:50:37: note: expanded from macro 'bitop' __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:479:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:439:2: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:365:48: note: expanded from macro 'PF_NO_TAIL' VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:51:16: note: expanded from macro 'bitop' (uintptr_t)(addr) != (uintptr_t)NULL && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:479:28: error: passing 'typeof (page)' (aka 'const struct page *') to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/page-flags.h:439:29: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/linux/page-flags.h:389:32: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:21: note: expanded from macro 'PF_NO_TAIL' PF_POISONED_CHECK(compound_head(page)); }) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ~~~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/bitops.h:51:16: note: expanded from macro 'bitop' (uintptr_t)(addr) != (uintptr_t)NULL && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:479:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:439:2: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:365:48: note: expanded from macro 'PF_NO_TAIL' VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:52:50: note: expanded from macro 'bitop' __builtin_constant_p(*(const unsigned long *)(addr))) ? \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:479:28: error: passing 'typeof (page)' (aka 'const struct page *') to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/page-flags.h:439:29: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/linux/page-flags.h:389:32: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:21: note: expanded from macro 'PF_NO_TAIL' PF_POISONED_CHECK(compound_head(page)); }) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ~~~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/bitops.h:52:50: note: expanded from macro 'bitop' __builtin_constant_p(*(const unsigned long *)(addr))) ? \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:479:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:439:2: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:365:48: note: expanded from macro 'PF_NO_TAIL' VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:53:17: note: expanded from macro 'bitop' const##op(nr, addr) : op(nr, addr)) ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:479:28: error: passing 'typeof (page)' (aka 'const struct page *') to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/page-flags.h:439:29: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/linux/page-flags.h:389:32: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:21: note: expanded from macro 'PF_NO_TAIL' PF_POISONED_CHECK(compound_head(page)); }) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ~~~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/bitops.h:53:17: note: expanded from macro 'bitop' const##op(nr, addr) : op(nr, addr)) ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:479:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:439:2: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:365:48: note: expanded from macro 'PF_NO_TAIL' VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:53:32: note: expanded from macro 'bitop' const##op(nr, addr) : op(nr, addr)) ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: >> include/linux/page-flags.h:479:28: error: passing 'typeof (page)' (aka 'const struct page *') to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] __PAGEFLAG(Locked, locked, PF_NO_TAIL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/page-flags.h:439:29: note: expanded from macro '__PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/linux/page-flags.h:389:32: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:366:21: note: expanded from macro 'PF_NO_TAIL' PF_POISONED_CHECK(compound_head(page)); }) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ~~~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/bitops.h:53:32: note: expanded from macro 'bitop' const##op(nr, addr) : op(nr, addr)) ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:480:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:434:2: note: expanded from macro 'PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:362:37: note: expanded from macro 'PF_ONLY_HEAD' VM_BUG_ON_PGFLAGS(PageTail(page), page); \ ^~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:50:37: note: expanded from macro 'bitop' __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:480:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:434:2: note: expanded from macro 'PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:363:21: note: expanded from macro 'PF_ONLY_HEAD' PF_POISONED_CHECK(page); }) ^~~~ note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/mmdebug.h:21:14: note: expanded from macro 'VM_BUG_ON_PAGE' dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ ^~~~ include/linux/bitops.h:61:50: note: expanded from macro 'test_bit' #define test_bit(nr, addr) bitop(_test_bit, nr, addr) ^~~~ include/linux/bitops.h:50:37: note: expanded from macro 'bitop' __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ ^~~~ include/linux/mmdebug.h:12:29: note: passing argument to parameter 'page' here void dump_page(struct page *page, const char *reason); ^ In file included from arch/x86/kernel/asm-offsets.c:9: In file included from include/linux/crypto.h:20: In file included from include/linux/slab.h:15: In file included from include/linux/gfp.h:7: In file included from include/linux/mmzone.h:22: include/linux/page-flags.h:480:1: error: passing 'const struct page *' to parameter of type 'struct page *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:434:2: note: expanded from macro 'PAGEFLAG' TESTPAGEFLAG(uname, lname, policy) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/page-flags.h:389:39: note: expanded from macro 'TESTPAGEFLAG' { return test_bit(PG_##lname, &policy(page, 0)->flags); } ^~~~ include/linux/page-flags.h:362:37: note: expanded from macro 'PF_ONLY_HEAD' VM_BUG_ON_PGFLAGS(PageTail(page), page); \ 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 321 static unsigned long *folio_flags(struct folio *folio, unsigned n) 322 { 323 struct page *page = &folio->page; 324 325 VM_BUG_ON_PGFLAGS(PageTail(page), page); 326 VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); 327 return &page[n].flags; 328 } 329 330 /* 331 * Page flags policies wrt compound pages 332 * 333 * PF_POISONED_CHECK 334 * check if this struct page poisoned/uninitialized 335 * 336 * PF_ANY: 337 * the page flag is relevant for small, head and tail pages. 338 * 339 * PF_HEAD: 340 * for compound page all operations related to the page flag applied to 341 * head page. 342 * 343 * PF_ONLY_HEAD: 344 * for compound page, callers only ever operate on the head page. 345 * 346 * PF_NO_TAIL: 347 * modifications of the page flag must be done on small or head pages, 348 * checks can be done on tail pages too. 349 * 350 * PF_NO_COMPOUND: 351 * the page flag is not relevant for compound pages. 352 * 353 * PF_SECOND: 354 * the page flag is stored in the first tail page. 355 */ 356 #define PF_POISONED_CHECK(page) ({ \ 357 VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \ 358 page; }) 359 #define PF_ANY(page, enforce) PF_POISONED_CHECK(page) 360 #define PF_HEAD(page, enforce) PF_POISONED_CHECK(compound_head(page)) 361 #define PF_ONLY_HEAD(page, enforce) ({ \ 362 VM_BUG_ON_PGFLAGS(PageTail(page), page); \ 363 PF_POISONED_CHECK(page); }) 364 #define PF_NO_TAIL(page, enforce) ({ \ 365 VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ 366 PF_POISONED_CHECK(compound_head(page)); }) 367 #define PF_NO_COMPOUND(page, enforce) ({ \ 368 VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \ 369 PF_POISONED_CHECK(page); }) 370 #define PF_SECOND(page, enforce) ({ \ 371 VM_BUG_ON_PGFLAGS(!PageHead(page), page); \ 372 PF_POISONED_CHECK(&page[1]); }) 373 374 /* Which page is the flag stored in */ 375 #define FOLIO_PF_ANY 0 376 #define FOLIO_PF_HEAD 0 377 #define FOLIO_PF_ONLY_HEAD 0 378 #define FOLIO_PF_NO_TAIL 0 379 #define FOLIO_PF_NO_COMPOUND 0 380 #define FOLIO_PF_SECOND 1 381 382 /* 383 * Macros to create function definitions for page flags 384 */ 385 #define TESTPAGEFLAG(uname, lname, policy) \ 386 static __always_inline bool folio_test_##lname(const struct folio *folio) \ 387 { return test_bit(PG_##lname, const_folio_flags(folio, FOLIO_##policy)); } \ 388 static __always_inline bool Page##uname(const struct page *page) \ 389 { return test_bit(PG_##lname, &policy(page, 0)->flags); } 390 391 #define SETPAGEFLAG(uname, lname, policy) \ 392 static __always_inline \ 393 void folio_set_##lname(struct folio *folio) \ 394 { set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 395 static __always_inline void SetPage##uname(struct page *page) \ 396 { set_bit(PG_##lname, &policy(page, 1)->flags); } 397 398 #define CLEARPAGEFLAG(uname, lname, policy) \ 399 static __always_inline \ 400 void folio_clear_##lname(struct folio *folio) \ 401 { clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 402 static __always_inline void ClearPage##uname(struct page *page) \ 403 { clear_bit(PG_##lname, &policy(page, 1)->flags); } 404 405 #define __SETPAGEFLAG(uname, lname, policy) \ 406 static __always_inline \ 407 void __folio_set_##lname(struct folio *folio) \ 408 { __set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 409 static __always_inline void __SetPage##uname(struct page *page) \ 410 { __set_bit(PG_##lname, &policy(page, 1)->flags); } 411 412 #define __CLEARPAGEFLAG(uname, lname, policy) \ 413 static __always_inline \ 414 void __folio_clear_##lname(struct folio *folio) \ 415 { __clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 416 static __always_inline void __ClearPage##uname(struct page *page) \ 417 { __clear_bit(PG_##lname, &policy(page, 1)->flags); } 418 419 #define TESTSETFLAG(uname, lname, policy) \ 420 static __always_inline \ 421 bool folio_test_set_##lname(struct folio *folio) \ 422 { return test_and_set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 423 static __always_inline bool TestSetPage##uname(struct page *page) \ 424 { return test_and_set_bit(PG_##lname, &policy(page, 1)->flags); } 425 426 #define TESTCLEARFLAG(uname, lname, policy) \ 427 static __always_inline \ 428 bool folio_test_clear_##lname(struct folio *folio) \ 429 { return test_and_clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ 430 static __always_inline bool TestClearPage##uname(struct page *page) \ 431 { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); } 432 433 #define PAGEFLAG(uname, lname, policy) \ 434 TESTPAGEFLAG(uname, lname, policy) \ 435 SETPAGEFLAG(uname, lname, policy) \ 436 CLEARPAGEFLAG(uname, lname, policy) 437 438 #define __PAGEFLAG(uname, lname, policy) \ 439 TESTPAGEFLAG(uname, lname, policy) \ 440 __SETPAGEFLAG(uname, lname, policy) \ 441 __CLEARPAGEFLAG(uname, lname, policy) 442 443 #define TESTSCFLAG(uname, lname, policy) \ 444 TESTSETFLAG(uname, lname, policy) \ 445 TESTCLEARFLAG(uname, lname, policy) 446 447 #define TESTPAGEFLAG_FALSE(uname, lname) \ 448 static inline bool folio_test_##lname(const struct folio *folio) { return false; } \ 449 static inline bool Page##uname(const struct page *page) { return false; } 450 451 #define SETPAGEFLAG_NOOP(uname, lname) \ 452 static inline void folio_set_##lname(struct folio *folio) { } \ 453 static inline void SetPage##uname(struct page *page) { } 454 455 #define CLEARPAGEFLAG_NOOP(uname, lname) \ 456 static inline void folio_clear_##lname(struct folio *folio) { } \ 457 static inline void ClearPage##uname(struct page *page) { } 458 459 #define __CLEARPAGEFLAG_NOOP(uname, lname) \ 460 static inline void __folio_clear_##lname(struct folio *folio) { } \ 461 static inline void __ClearPage##uname(struct page *page) { } 462 463 #define TESTSETFLAG_FALSE(uname, lname) \ 464 static inline bool folio_test_set_##lname(struct folio *folio) \ 465 { return false; } \ 466 static inline bool TestSetPage##uname(struct page *page) { return false; } 467 468 #define TESTCLEARFLAG_FALSE(uname, lname) \ 469 static inline bool folio_test_clear_##lname(struct folio *folio) \ 470 { return false; } \ 471 static inline bool TestClearPage##uname(struct page *page) { return false; } 472 473 #define PAGEFLAG_FALSE(uname, lname) TESTPAGEFLAG_FALSE(uname, lname) \ 474 SETPAGEFLAG_NOOP(uname, lname) CLEARPAGEFLAG_NOOP(uname, lname) 475 476 #define TESTSCFLAG_FALSE(uname, lname) \ 477 TESTSETFLAG_FALSE(uname, lname) TESTCLEARFLAG_FALSE(uname, lname) 478 > 479 __PAGEFLAG(Locked, locked, PF_NO_TAIL) 480 PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) 481 PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) 482 PAGEFLAG(Referenced, referenced, PF_HEAD) 483 TESTCLEARFLAG(Referenced, referenced, PF_HEAD) 484 __SETPAGEFLAG(Referenced, referenced, PF_HEAD) 485 PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD) 486 __CLEARPAGEFLAG(Dirty, dirty, PF_HEAD) 487 PAGEFLAG(LRU, lru, PF_HEAD) __CLEARPAGEFLAG(LRU, lru, PF_HEAD) 488 TESTCLEARFLAG(LRU, lru, PF_HEAD) 489 PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD) 490 TESTCLEARFLAG(Active, active, PF_HEAD) 491 PAGEFLAG(Workingset, workingset, PF_HEAD) 492 TESTCLEARFLAG(Workingset, workingset, PF_HEAD) 493 __PAGEFLAG(Slab, slab, PF_NO_TAIL) 494 __PAGEFLAG(SlobFree, slob_free, PF_NO_TAIL) 495 PAGEFLAG(Checked, checked, PF_NO_COMPOUND) /* Used by some filesystems */ 496 -- 0-DAY CI Kernel Test Service https://01.org/lkp