* [RESEND PATCH] x86: remove redundant check for kmem_cache_create()
@ 2018-06-12 10:16 Chengguang Xu
2018-06-12 11:27 ` kbuild test robot
2018-06-12 14:33 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Chengguang Xu @ 2018-06-12 10:16 UTC (permalink / raw)
To: tglx, mingo, hpa; +Cc: x86, linux-kernel, Chengguang Xu
The flag 'SLAB_PANIC' implies panic when encouter failure,
so there is no need to check NULL pointer and return error
code.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
arch/x86/mm/pgtable.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 47b5951..4392414 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -312,14 +312,14 @@ static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[])
static struct kmem_cache *pgd_cache;
-static int __init pgd_cache_init(void)
+static void __init pgd_cache_init(void)
{
/*
* When PAE kernel is running as a Xen domain, it does not use
* shared kernel pmd. And this requires a whole page for pgd.
*/
if (!SHARED_KERNEL_PMD)
- return 0;
+ return;
/*
* when PAE kernel is not running as a Xen domain, it uses
@@ -329,10 +329,6 @@ static int __init pgd_cache_init(void)
*/
pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_ALIGN,
SLAB_PANIC, NULL);
- if (!pgd_cache)
- return -ENOMEM;
-
- return 0;
}
core_initcall(pgd_cache_init);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] x86: remove redundant check for kmem_cache_create()
2018-06-12 10:16 [RESEND PATCH] x86: remove redundant check for kmem_cache_create() Chengguang Xu
@ 2018-06-12 11:27 ` kbuild test robot
2018-06-12 14:33 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-06-12 11:27 UTC (permalink / raw)
To: Chengguang Xu
Cc: kbuild-all, tglx, mingo, hpa, x86, linux-kernel, Chengguang Xu
[-- Attachment #1: Type: text/plain, Size: 3427 bytes --]
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@intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27466 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] x86: remove redundant check for kmem_cache_create()
2018-06-12 10:16 [RESEND PATCH] x86: remove redundant check for kmem_cache_create() Chengguang Xu
2018-06-12 11:27 ` kbuild test robot
@ 2018-06-12 14:33 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-06-12 14:33 UTC (permalink / raw)
To: Chengguang Xu
Cc: kbuild-all, tglx, mingo, hpa, x86, linux-kernel, Chengguang Xu
[-- Attachment #1: Type: text/plain, Size: 3520 bytes --]
Hi Chengguang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/x86/core]
[also build test ERROR 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-x012-201823 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/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: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
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);
^~~~~~~~~~~~~
cc1: some warnings being treated as errors
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@intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31736 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-12 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 10:16 [RESEND PATCH] x86: remove redundant check for kmem_cache_create() Chengguang Xu
2018-06-12 11:27 ` kbuild test robot
2018-06-12 14:33 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.