Hi Bernard, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.7-rc1 next-20200416] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Bernard-Zhao/kmalloc_index-optimization-code-size-runtime-stable/20200417-100445 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2fcd80144b93ff90836a44f2054b4d82133d3a85 config: powerpc-defconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 40d139c620f83509fe18acbff5ec358298e99def) reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:15: In file included from include/linux/socket.h:8: In file included from include/linux/uio.h:10: In file included from include/crypto/hash.h:11: In file included from include/linux/crypto.h:19: >> include/linux/slab.h:390:3: error: use of undeclared identifier 'high_bit' high_bit = fls((int)size); ^ include/linux/slab.h:392:22: error: use of undeclared identifier 'high_bit' if (size == (2 << (high_bit - KMALLOC_SIZE_POW_2_SHIFT_BIT))) ^ include/linux/slab.h:393:12: error: use of undeclared identifier 'high_bit' return (high_bit - KMALLOC_SIZE_POW_2_INDEX_BIT); ^ include/linux/slab.h:395:10: error: use of undeclared identifier 'high_bit' return high_bit; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:87:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set->sig[3] | set->sig[2] | ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:87:25: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set->sig[3] | set->sig[2] | ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:88:4: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds] set->sig[1] | set->sig[0]) == 0; ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:90:11: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set->sig[1] | set->sig[0]) == 0; ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:103:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set1->sig[3] == set2->sig[3]) && ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:103:27: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set1->sig[3] == set2->sig[3]) && ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:104:5: warning: array index 2 is past the end of the array (which contains 1 element) [-Warray-bounds] (set1->sig[2] == set2->sig[2]) && ^ ~ arch/powerpc/include/uapi/asm/signal.h:18:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ In file included from arch/powerpc/kernel/asm-offsets.c:14: In file included from include/linux/compat.h:17: In file included from include/linux/fs.h:34: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: vim +/high_bit +390 include/linux/slab.h 356 357 /* 358 * Figure out which kmalloc slab an allocation of a certain size 359 * belongs to. 360 * 0 = zero alloc 361 * 1 = 65 .. 96 bytes 362 * 2 = 129 .. 192 bytes 363 * n = 2^(n-1)+1 .. 2^n 364 */ 365 static __always_inline unsigned int kmalloc_index(size_t size) 366 { 367 if (!size) 368 return 0; 369 370 if (size <= KMALLOC_MIN_SIZE) 371 return KMALLOC_SHIFT_LOW; 372 373 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96) 374 return 1; 375 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192) 376 return 2; 377 378 if (size <= 8) 379 return 3; 380 381 /* size over KMALLOC_MAX_SIZE should trigger BUG */ 382 if (size <= KMALLOC_MAX_SIZE) { 383 /* 384 * kmalloc_info[index] 385 * size 8----16----32----64----128---256---512---1024---2048. 386 * | | | | | | | | | | | | | | | | | 387 * index 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 388 */ 389 > 390 high_bit = fls((int)size); 391 392 if (size == (2 << (high_bit - KMALLOC_SIZE_POW_2_SHIFT_BIT))) 393 return (high_bit - KMALLOC_SIZE_POW_2_INDEX_BIT); 394 395 return high_bit; 396 } 397 398 BUG(); 399 400 /* Will never be reached. Needed because the compiler may complain */ 401 return -1; 402 } 403 #endif /* !CONFIG_SLOB */ 404 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip