Hi Christoph, kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Christoph-Hellwig/mm-slab-improve-kmem_cache_alloc_bulk/20260527-150421 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20260527070239.2252948-2-hch%40lst.de patch subject: [PATCH] mm/slab: improve kmem_cache_alloc_bulk config: parisc-randconfig-r071-20260528 (https://download.01.org/0day-ci/archive/20260528/[email protected]/config) compiler: hppa-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9c reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All errors (new ones prefixed by >>): lib/test_meminit.c: In function 'do_kmem_cache_size': >> lib/test_meminit.c:239:29: error: 'ret' undeclared (first use in this >> function); did you mean 'net'? kmem_cache_free_bulk(c, ret, bulk_array); ^~~ net lib/test_meminit.c:239:29: note: each undeclared identifier is reported only once for each function it appears in vim +239 lib/test_meminit.c dc5c5ad79f0cc2d Laura Abbott 2019-12-04 209 5015a300a522c8f Alexander Potapenko 2019-07-16 210 /* 5015a300a522c8f Alexander Potapenko 2019-07-16 211 * Test kmem_cache with given parameters: 5015a300a522c8f Alexander Potapenko 2019-07-16 212 * want_ctor - use a constructor; 5015a300a522c8f Alexander Potapenko 2019-07-16 213 * want_rcu - use SLAB_TYPESAFE_BY_RCU; 5015a300a522c8f Alexander Potapenko 2019-07-16 214 * want_zero - use __GFP_ZERO. 5015a300a522c8f Alexander Potapenko 2019-07-16 215 */ 5015a300a522c8f Alexander Potapenko 2019-07-16 216 static int __init do_kmem_cache_size(size_t size, bool want_ctor, 5015a300a522c8f Alexander Potapenko 2019-07-16 217 bool want_rcu, bool want_zero, 5015a300a522c8f Alexander Potapenko 2019-07-16 218 int *total_failures) 5015a300a522c8f Alexander Potapenko 2019-07-16 219 { 5015a300a522c8f Alexander Potapenko 2019-07-16 220 struct kmem_cache *c; 5015a300a522c8f Alexander Potapenko 2019-07-16 221 int iter; 5015a300a522c8f Alexander Potapenko 2019-07-16 222 bool fail = false; 5015a300a522c8f Alexander Potapenko 2019-07-16 223 gfp_t alloc_mask = GFP_KERNEL | (want_zero ? __GFP_ZERO : 0); 5015a300a522c8f Alexander Potapenko 2019-07-16 224 void *buf, *buf_copy; 5015a300a522c8f Alexander Potapenko 2019-07-16 225 5015a300a522c8f Alexander Potapenko 2019-07-16 226 c = kmem_cache_create("test_cache", size, 1, 5015a300a522c8f Alexander Potapenko 2019-07-16 227 want_rcu ? SLAB_TYPESAFE_BY_RCU : 0, 5015a300a522c8f Alexander Potapenko 2019-07-16 228 want_ctor ? test_ctor : NULL); 5015a300a522c8f Alexander Potapenko 2019-07-16 229 for (iter = 0; iter < 10; iter++) { dc5c5ad79f0cc2d Laura Abbott 2019-12-04 230 /* Do a test of bulk allocations */ dc5c5ad79f0cc2d Laura Abbott 2019-12-04 231 if (!want_rcu && !want_ctor) { 863d4ee245fb4d6 Christoph Hellwig 2026-05-27 232 if (!kmem_cache_alloc_bulk(c, alloc_mask, BULK_SIZE, 863d4ee245fb4d6 Christoph Hellwig 2026-05-27 233 bulk_array)) { dc5c5ad79f0cc2d Laura Abbott 2019-12-04 234 fail = true; dc5c5ad79f0cc2d Laura Abbott 2019-12-04 235 } else { dc5c5ad79f0cc2d Laura Abbott 2019-12-04 236 int i; 863d4ee245fb4d6 Christoph Hellwig 2026-05-27 237 for (i = 0; i < BULK_SIZE; i++) dc5c5ad79f0cc2d Laura Abbott 2019-12-04 238 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero); dc5c5ad79f0cc2d Laura Abbott 2019-12-04 @239 kmem_cache_free_bulk(c, ret, bulk_array); dc5c5ad79f0cc2d Laura Abbott 2019-12-04 240 } dc5c5ad79f0cc2d Laura Abbott 2019-12-04 241 } dc5c5ad79f0cc2d Laura Abbott 2019-12-04 242 5015a300a522c8f Alexander Potapenko 2019-07-16 243 buf = kmem_cache_alloc(c, alloc_mask); 5015a300a522c8f Alexander Potapenko 2019-07-16 244 /* Check that buf is zeroed, if it must be. */ dc5c5ad79f0cc2d Laura Abbott 2019-12-04 245 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero); 5015a300a522c8f Alexander Potapenko 2019-07-16 246 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0); d3a811617ae629d Arnd Bergmann 2019-07-16 247 d3a811617ae629d Arnd Bergmann 2019-07-16 248 if (!want_rcu) { d3a811617ae629d Arnd Bergmann 2019-07-16 249 kmem_cache_free(c, buf); d3a811617ae629d Arnd Bergmann 2019-07-16 250 continue; d3a811617ae629d Arnd Bergmann 2019-07-16 251 } d3a811617ae629d Arnd Bergmann 2019-07-16 252 5015a300a522c8f Alexander Potapenko 2019-07-16 253 /* 5015a300a522c8f Alexander Potapenko 2019-07-16 254 * If this is an RCU cache, use a critical section to ensure we 5015a300a522c8f Alexander Potapenko 2019-07-16 255 * can touch objects after they're freed. 5015a300a522c8f Alexander Potapenko 2019-07-16 256 */ 5015a300a522c8f Alexander Potapenko 2019-07-16 257 rcu_read_lock(); 5015a300a522c8f Alexander Potapenko 2019-07-16 258 /* 5015a300a522c8f Alexander Potapenko 2019-07-16 259 * Copy the buffer to check that it's not wiped on 5015a300a522c8f Alexander Potapenko 2019-07-16 260 * free(). 5015a300a522c8f Alexander Potapenko 2019-07-16 261 */ 733d1d1a7745113 Alexander Potapenko 2019-08-02 262 buf_copy = kmalloc(size, GFP_ATOMIC); 5015a300a522c8f Alexander Potapenko 2019-07-16 263 if (buf_copy) 5015a300a522c8f Alexander Potapenko 2019-07-16 264 memcpy(buf_copy, buf, size); d3a811617ae629d Arnd Bergmann 2019-07-16 265 4ab7ace465466d2 Alexander Potapenko 2019-07-16 266 kmem_cache_free(c, buf); 5015a300a522c8f Alexander Potapenko 2019-07-16 267 /* 5015a300a522c8f Alexander Potapenko 2019-07-16 268 * Check that |buf| is intact after kmem_cache_free(). 5015a300a522c8f Alexander Potapenko 2019-07-16 269 * |want_zero| is false, because we wrote garbage to 5015a300a522c8f Alexander Potapenko 2019-07-16 270 * the buffer already. 5015a300a522c8f Alexander Potapenko 2019-07-16 271 */ 5015a300a522c8f Alexander Potapenko 2019-07-16 272 fail |= check_buf(buf, size, want_ctor, want_rcu, 5015a300a522c8f Alexander Potapenko 2019-07-16 273 false); 5015a300a522c8f Alexander Potapenko 2019-07-16 274 if (buf_copy) { 5015a300a522c8f Alexander Potapenko 2019-07-16 275 fail |= (bool)memcmp(buf, buf_copy, size); 5015a300a522c8f Alexander Potapenko 2019-07-16 276 kfree(buf_copy); 5015a300a522c8f Alexander Potapenko 2019-07-16 277 } 5015a300a522c8f Alexander Potapenko 2019-07-16 278 rcu_read_unlock(); 5015a300a522c8f Alexander Potapenko 2019-07-16 279 } 5015a300a522c8f Alexander Potapenko 2019-07-16 280 kmem_cache_destroy(c); 5015a300a522c8f Alexander Potapenko 2019-07-16 281 5015a300a522c8f Alexander Potapenko 2019-07-16 282 *total_failures += fail; 5015a300a522c8f Alexander Potapenko 2019-07-16 283 return 1; 5015a300a522c8f Alexander Potapenko 2019-07-16 284 } 5015a300a522c8f Alexander Potapenko 2019-07-16 285 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
