diff options
author | Shaohua Li <shaohua.li@intel.com> | 2006-06-27 05:53:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:37 -0400 |
commit | bd9e0b74f52dbac6241643fadca2393808b14c7a (patch) | |
tree | af2c479782edbeca009cf195401d82abb61b1ac7 /arch/i386/kernel/cpu | |
parent | 28eba5bf9d4bf3ba4d58d985abf3a2903b7f2125 (diff) |
[PATCH] x86: cpu_init(): avoid GFP_KERNEL allocation while atomic
The patch fixes two issues:
1. cpu_init is called with interrupt disabled. Allocating gdt table
there isn't good at runtime.
2. gdt table page cause memory leak in CPU hotplug case.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 44f2c5f2dda1..640364d9b661 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -613,6 +613,12 @@ void __cpuinit cpu_init(void) | |||
613 | set_in_cr4(X86_CR4_TSD); | 613 | set_in_cr4(X86_CR4_TSD); |
614 | } | 614 | } |
615 | 615 | ||
616 | /* The CPU hotplug case */ | ||
617 | if (cpu_gdt_descr->address) { | ||
618 | gdt = (struct desc_struct *)cpu_gdt_descr->address; | ||
619 | memset(gdt, 0, PAGE_SIZE); | ||
620 | goto old_gdt; | ||
621 | } | ||
616 | /* | 622 | /* |
617 | * This is a horrible hack to allocate the GDT. The problem | 623 | * This is a horrible hack to allocate the GDT. The problem |
618 | * is that cpu_init() is called really early for the boot CPU | 624 | * is that cpu_init() is called really early for the boot CPU |
@@ -631,7 +637,7 @@ void __cpuinit cpu_init(void) | |||
631 | local_irq_enable(); | 637 | local_irq_enable(); |
632 | } | 638 | } |
633 | } | 639 | } |
634 | 640 | old_gdt: | |
635 | /* | 641 | /* |
636 | * Initialize the per-CPU GDT with the boot GDT, | 642 | * Initialize the per-CPU GDT with the boot GDT, |
637 | * and set up the GDT descriptor: | 643 | * and set up the GDT descriptor: |