Gdt hotplug
PATCH 3/3 Gdt hotplug
As suggested by Andi Kleen, don't allocate a GDT page if there is already one present. Needed for CPU hotplug.
arch/i386/kernel/smpboot.c +2 -1
@@ -898,7 +898,8 @@ static int __devinit do_boot_cpu(int api* This grunge runs the startup process for * the targeted processor. */ - cpu_gdt_descr[cpu].address =__get_free_page (GFP_KERNEL |__GFP_ZERO); +if (!cpu_gdt_descr[cpu].address) + cpu_gdt_descr[cpu].address =__get_free_page (GFP_KERNEL |__GFP_ZERO);atomic_set (&init_deasserted,0 );
Quoted 2 lines · Zachary Amsden
As suggested by Andi Kleen, don't allocate a GDT page if there is already one present. Needed for CPU hotplug.
Did I really suggest that? I think I suggested checking the return value of gfp. Also get_zeroed_page() is slightly cleaner than GFP_ZERO.
-Andi
Quoted 16 lines
Signed-off-by Zachary Amsden <[email protected]>Index:
linux-2.6.14-rc1/arch/i386/kernel/smpboot.c
===================================================================
---linux-2.6.14-rc1.orig/arch/i386/kernel/smpboot.c2005-09-20
20:38:22.000000000 -0700 +++linux-2.6.14-rc1/arch/i386/kernel/smpboot.c2005-09-28 12:54:08.000000000
-0700 @@ -898,7 +898,8 @@ static int__devinitdo_boot_cpu(int apiarch/i386/kernel/smpboot.c +2
-1* This grunge runs the startup process for * the targeted processor. */ - cpu_gdt_descr[cpu].address =__get_free_page (GFP_KERNEL |__GFP_ZERO); +if (!cpu_gdt_descr[cpu].address) + cpu_gdt_descr[cpu].address =__get_free_page (GFP_KERNEL |__GFP_ZERO);atomic_set (&init_deasserted,0 );
Quoted 6 lines · * Andi Kleen ([email protected]) wrote:
Quoted 2 lines · Zachary Amsden
As suggested by Andi Kleen, don't allocate a GDT page if there is already one present. Needed for CPU hotplug.
Did I really suggest that? I think I suggested checking the return value of gfp. Also
get_zeroed_page()is slightly cleaner thanGFP_ZERO.
Yes, my recollection is you were talking about failed allocation.
thanks,
-chris
Quoted 12 lines · Andi Kleen
Quoted 4 lines · Zachary Amsden
As suggested by Andi Kleen, don't allocate a GDT page if there is already one present. Needed for CPU hotplug.
Did I really suggest that? I think I suggested checking the return value of gfp. Also
get_zeroed_page()is slightly cleaner thanGFP_ZERO.
Then I think this looks better all around.
As suggested by Andi Kleen, don't allocate a GDT page if there is already one present. Needed for CPU hotplug.
arch/i386/kernel/smpboot.c +6 -2
@@ -874,6 +874,12 @@ static int __devinit do_boot_cpu(int apiunsigned long start_eip;unsigned short nmi_high =0 , nmi_low =0 ; +if (!cpu_gdt_descr[cpu].address && + !(cpu_gdt_descr[cpu].address =get_zeroed_page (GFP_KERNEL ))) { +printk ("Failed to allocate GDT for CPU %d\n" , cpu); +return 1 ; + } + ++cpucount;/*
@@ -898,8 +904,6 @@ static int __devinit do_boot_cpu(int api* This grunge runs the startup process for * the targeted processor. */ - cpu_gdt_descr[cpu].address =__get_free_page (GFP_KERNEL |__GFP_ZERO); -atomic_set (&init_deasserted,0 );Dprintk ("Setting warm reset code and vector.\n" );