Re: [RESEND PATCH] x86: remove redundant check for kmem_cache_create()

From: cgxu519@xxxxxxx
Date: Tue Jun 12 2018 - 07:38:58 EST


So still need to keep return type as int, I’ll fix in V2.

Thanks.


> 在 2018年6月12日,下午7:27,kbuild test robot <lkp@xxxxxxxxx> 写道:
>
> Hi Chengguang,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on tip/x86/core]
> [also build test WARNING on v4.17 next-20180612]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Chengguang-Xu/x86-remove-redundant-check-for-kmem_cache_create/20180612-182134
> config: i386-randconfig-a1-201823 (attached as .config)
> compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/printk.h:5:0,
> from include/linux/kernel.h:13,
> from include/asm-generic/bug.h:15,
> from arch/x86/include/asm/bug.h:81,
> from include/linux/bug.h:4,
> from include/linux/mmdebug.h:4,
> from include/linux/mm.h:8,
> from arch/x86/mm/pgtable.c:1:
>>> arch/x86/mm/pgtable.c:327:15: warning: initialization from incompatible pointer type
> core_initcall(pgd_cache_init);
> ^
> include/linux/init.h:166:58: note: in definition of macro '__define_initcall'
> __attribute__((__section__(".initcall" #id ".init"))) = fn;
> ^
> arch/x86/mm/pgtable.c:327:1: note: in expansion of macro 'core_initcall'
> core_initcall(pgd_cache_init);
> ^
>
> vim +327 arch/x86/mm/pgtable.c
>
> 1db491f7 Fenghua Yu 2015-01-15 308
> d524db50 Chengguang Xu 2018-06-12 309 static void __init pgd_cache_init(void)
> 1db491f7 Fenghua Yu 2015-01-15 310 {
> 1db491f7 Fenghua Yu 2015-01-15 311 /*
> 1db491f7 Fenghua Yu 2015-01-15 312 * When PAE kernel is running as a Xen domain, it does not use
> 1db491f7 Fenghua Yu 2015-01-15 313 * shared kernel pmd. And this requires a whole page for pgd.
> 1db491f7 Fenghua Yu 2015-01-15 314 */
> 1db491f7 Fenghua Yu 2015-01-15 315 if (!SHARED_KERNEL_PMD)
> d524db50 Chengguang Xu 2018-06-12 316 return;
> 1db491f7 Fenghua Yu 2015-01-15 317
> 1db491f7 Fenghua Yu 2015-01-15 318 /*
> 1db491f7 Fenghua Yu 2015-01-15 319 * when PAE kernel is not running as a Xen domain, it uses
> 1db491f7 Fenghua Yu 2015-01-15 320 * shared kernel pmd. Shared kernel pmd does not require a whole
> 1db491f7 Fenghua Yu 2015-01-15 321 * page for pgd. We are able to just allocate a 32-byte for pgd.
> 1db491f7 Fenghua Yu 2015-01-15 322 * During boot time, we create a 32-byte slab for pgd table allocation.
> 1db491f7 Fenghua Yu 2015-01-15 323 */
> 1db491f7 Fenghua Yu 2015-01-15 324 pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_ALIGN,
> 1db491f7 Fenghua Yu 2015-01-15 325 SLAB_PANIC, NULL);
> 1db491f7 Fenghua Yu 2015-01-15 326 }
> 1db491f7 Fenghua Yu 2015-01-15 @327 core_initcall(pgd_cache_init);
> 1db491f7 Fenghua Yu 2015-01-15 328
>
> :::::: The code at line 327 was first introduced by commit
> :::::: 1db491f77b6ed0f32f1d4a3ac40a5be9524f1914 x86/mm: Reduce PAE-mode per task pgd allocation overhead from 4K to 32 bytes
>
> :::::: TO: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> :::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
> <.config.gz>