tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b992b79ca8bc336fa8e2c80990b5af80ed8f36fd commit: 23c593d8220af52504cff1d99fbd39ab56a02c82 [6386/7397] mm/swap: reduce swap cache search space config: x86_64-randconfig-014-20240202 (https://download.01.org/0day-ci/archive/20240621/202406211750.Ks4k82Gi-lkp@xxxxxxxxx/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240621/202406211750.Ks4k82Gi-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202406211750.Ks4k82Gi-lkp@xxxxxxxxx/ All errors (new ones prefixed by >>): mm/swap_state.c:65:6: error: redefinition of 'show_swap_cache_info' 65 | void show_swap_cache_info(void) | ^~~~~~~~~~~~~~~~~~~~ In file included from mm/swap_state.c:27: mm/swap.h:104:20: note: previous definition of 'show_swap_cache_info' with type 'void(void)' 104 | static inline void show_swap_cache_info(void) | ^~~~~~~~~~~~~~~~~~~~ mm/swap_state.c:72:7: error: redefinition of 'get_shadow_from_swap_cache' 72 | void *get_shadow_from_swap_cache(swp_entry_t entry) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ mm/swap.h:147:21: note: previous definition of 'get_shadow_from_swap_cache' with type 'void *(swp_entry_t)' 147 | static inline void *get_shadow_from_swap_cache(swp_entry_t entry) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ mm/swap_state.c:88:5: error: redefinition of 'add_to_swap_cache' 88 | int add_to_swap_cache(struct folio *folio, swp_entry_t entry, | ^~~~~~~~~~~~~~~~~ mm/swap.h:152:19: note: previous definition of 'add_to_swap_cache' with type 'int(struct folio *, swp_entry_t, gfp_t, void **)' {aka 'int(struct folio *, swp_entry_t, unsigned int, void **)'} 152 | static inline int add_to_swap_cache(struct folio *folio, swp_entry_t entry, | ^~~~~~~~~~~~~~~~~ mm/swap_state.c: In function 'add_to_swap_cache': mm/swap_state.c:124:48: error: 'NR_SWAPCACHE' undeclared (first use in this function) 124 | __lruvec_stat_mod_folio(folio, NR_SWAPCACHE, nr); | ^~~~~~~~~~~~ mm/swap_state.c:124:48: note: each undeclared identifier is reported only once for each function it appears in mm/swap_state.c: At top level: mm/swap_state.c:141:6: error: redefinition of '__delete_from_swap_cache' 141 | void __delete_from_swap_cache(struct folio *folio, | ^~~~~~~~~~~~~~~~~~~~~~~~ mm/swap.h:158:20: note: previous definition of '__delete_from_swap_cache' with type 'void(struct folio *, swp_entry_t, void *)' 158 | static inline void __delete_from_swap_cache(struct folio *folio, | ^~~~~~~~~~~~~~~~~~~~~~~~ mm/swap_state.c: In function '__delete_from_swap_cache': mm/swap_state.c:165:40: error: 'NR_SWAPCACHE' undeclared (first use in this function) 165 | __lruvec_stat_mod_folio(folio, NR_SWAPCACHE, -nr); | ^~~~~~~~~~~~ mm/swap_state.c: At top level: mm/swap_state.c:178:6: error: redefinition of 'add_to_swap' 178 | bool add_to_swap(struct folio *folio) | ^~~~~~~~~~~ mm/swap.h:142:20: note: previous definition of 'add_to_swap' with type 'bool(struct folio *)' {aka '_Bool(struct folio *)'} 142 | static inline bool add_to_swap(struct folio *folio) | ^~~~~~~~~~~ mm/swap_state.c:235:6: error: redefinition of 'delete_from_swap_cache' 235 | void delete_from_swap_cache(struct folio *folio) | ^~~~~~~~~~~~~~~~~~~~~~ mm/swap.h:163:20: note: previous definition of 'delete_from_swap_cache' with type 'void(struct folio *)' 163 | static inline void delete_from_swap_cache(struct folio *folio) | ^~~~~~~~~~~~~~~~~~~~~~ mm/swap_state.c:248:6: error: redefinition of 'clear_shadow_from_swap_cache' 248 | void clear_shadow_from_swap_cache(int type, unsigned long begin, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/swap.h:167:20: note: previous definition of 'clear_shadow_from_swap_cache' with type 'void(int, long unsigned int, long unsigned int)' 167 | static inline void clear_shadow_from_swap_cache(int type, unsigned long begin, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/swap_state.c: In function 'clear_shadow_from_swap_cache': >> mm/swap_state.c:256:46: error: 'SWAP_ADDRESS_SPACE_MASK' undeclared (first use in this function) 256 | unsigned long index = curr & SWAP_ADDRESS_SPACE_MASK; | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/list_lru.h:14, from include/linux/fs.h:13, from include/linux/huge_mm.h:8, from include/linux/mm.h:1120, from mm/swap_state.c:10: mm/swap_state.c:263:67: error: 'SWAP_ADDRESS_SPACE_PAGES' undeclared (first use in this function) 263 | xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { | ^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/xarray.h:1799:36: note: in definition of macro 'xas_for_each' 1799 | for (entry = xas_find(xas, max); entry; \ | ^~~ include/linux/minmax.h:56:31: note: in expansion of macro '__is_constexpr' 56 | __builtin_choose_expr(__is_constexpr((x) - (y)), \ | ^~~~~~~~~~~~~~ include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp' 85 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ mm/swap_state.c:263:41: note: in expansion of macro 'min' 263 | xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { | ^~~ include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant 31 | __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \ | ^~~~~~~~~~~~~~~~~~~~~ include/linux/xarray.h:1799:36: note: in definition of macro 'xas_for_each' 1799 | for (entry = xas_find(xas, max); entry; \ | ^~~ include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert' 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:51:9: note: in expansion of macro 'static_assert' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~~~~ include/linux/minmax.h:39:28: note: in expansion of macro '__is_signed' 39 | (__is_signed(x) == __is_signed(y) || \ | ^~~~~~~~~~~ include/linux/minmax.h:51:23: note: in expansion of macro '__types_ok' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~ include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once' 58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y))) | ^~~~~~~~~~ include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp' 85 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ mm/swap_state.c:263:41: note: in expansion of macro 'min' 263 | xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { | ^~~ include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant 31 | __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \ | ^~~~~~~~~~~~~~~~~~~~~ include/linux/xarray.h:1799:36: note: in definition of macro 'xas_for_each' 1799 | for (entry = xas_find(xas, max); entry; \ | ^~~ include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert' 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:51:9: note: in expansion of macro 'static_assert' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~~~~ include/linux/minmax.h:40:41: note: in expansion of macro '__is_signed' 40 | __is_signed((x) + 0) == __is_signed((y) + 0) || \ | ^~~~~~~~~~~ include/linux/minmax.h:51:23: note: in expansion of macro '__types_ok' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~ include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once' 58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y))) | ^~~~~~~~~~ include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp' 85 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ mm/swap_state.c:263:41: note: in expansion of macro 'min' 263 | xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { | ^~~ include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant 31 | __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \ | ^~~~~~~~~~~~~~~~~~~~~ include/linux/xarray.h:1799:36: note: in definition of macro 'xas_for_each' 1799 | for (entry = xas_find(xas, max); entry; \ | ^~~ include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert' 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:51:9: note: in expansion of macro 'static_assert' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~~~~ include/linux/minmax.h:36:53: note: in expansion of macro '__is_signed' 36 | (__builtin_choose_expr(__is_constexpr(x) && __is_signed(x), x, -1) >= 0) | ^~~~~~~~~~~ include/linux/minmax.h:41:38: note: in expansion of macro '__is_noneg_int' 41 | __is_noneg_int(x) || __is_noneg_int(y)) | ^~~~~~~~~~~~~~ include/linux/minmax.h:51:23: note: in expansion of macro '__types_ok' 51 | static_assert(__types_ok(x, y), \ | ^~~~~~~~~~ include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once' 58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y))) | ^~~~~~~~~~ vim +/SWAP_ADDRESS_SPACE_MASK +256 mm/swap_state.c 247 248 void clear_shadow_from_swap_cache(int type, unsigned long begin, 249 unsigned long end) 250 { 251 unsigned long curr = begin; 252 void *old; 253 254 for (;;) { 255 swp_entry_t entry = swp_entry(type, curr); > 256 unsigned long index = curr & SWAP_ADDRESS_SPACE_MASK; 257 struct address_space *address_space = swap_address_space(entry); 258 XA_STATE(xas, &address_space->i_pages, index); 259 260 xas_set_update(&xas, workingset_update_node); 261 262 xa_lock_irq(&address_space->i_pages); 263 xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { 264 if (!xa_is_value(old)) 265 continue; 266 xas_store(&xas, NULL); 267 } 268 xa_unlock_irq(&address_space->i_pages); 269 270 /* search the next swapcache until we meet end */ 271 curr >>= SWAP_ADDRESS_SPACE_SHIFT; 272 curr++; 273 curr <<= SWAP_ADDRESS_SPACE_SHIFT; 274 if (curr > end) 275 break; 276 } 277 } 278 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki