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/smpboot.c | |
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/smpboot.c')
-rw-r--r-- | arch/i386/kernel/smpboot.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index bce5470ecb42..9466a3c9ff0d 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -1056,6 +1056,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
1056 | struct warm_boot_cpu_info info; | 1056 | struct warm_boot_cpu_info info; |
1057 | struct work_struct task; | 1057 | struct work_struct task; |
1058 | int apicid, ret; | 1058 | int apicid, ret; |
1059 | struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); | ||
1059 | 1060 | ||
1060 | apicid = x86_cpu_to_apicid[cpu]; | 1061 | apicid = x86_cpu_to_apicid[cpu]; |
1061 | if (apicid == BAD_APICID) { | 1062 | if (apicid == BAD_APICID) { |
@@ -1063,6 +1064,18 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
1063 | goto exit; | 1064 | goto exit; |
1064 | } | 1065 | } |
1065 | 1066 | ||
1067 | /* | ||
1068 | * the CPU isn't initialized at boot time, allocate gdt table here. | ||
1069 | * cpu_init will initialize it | ||
1070 | */ | ||
1071 | if (!cpu_gdt_descr->address) { | ||
1072 | cpu_gdt_descr->address = get_zeroed_page(GFP_KERNEL); | ||
1073 | if (!cpu_gdt_descr->address) | ||
1074 | printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); | ||
1075 | ret = -ENOMEM; | ||
1076 | goto exit; | ||
1077 | } | ||
1078 | |||
1066 | info.complete = &done; | 1079 | info.complete = &done; |
1067 | info.apicid = apicid; | 1080 | info.apicid = apicid; |
1068 | info.cpu = cpu; | 1081 | info.cpu = cpu; |