diff options
author | Ravikiran G Thirumalai <kiran@scalex86.org> | 2006-01-11 16:45:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 22:04:59 -0500 |
commit | 365ba9179f84244d2ffa98e46ae3cddfeb2ef6ff (patch) | |
tree | b84be7f9f929d8084fa76af2618877439baee841 /arch/x86_64/kernel | |
parent | df79efde82952edc653fa6eb1338a82b87aa0585 (diff) |
[PATCH] x86_64: Allocate PDAs in the local node
Patch uses a static PDA array early at boot and reallocates processor PDA
with node local memory when kmalloc is ready, just before pda_init.
The boot_cpu_pda is needed since the cpu_pda is used even before pda_init for
that cpu is called (to set the static per-cpu areas offset table etc)
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r-- | arch/x86_64/kernel/head64.c | 3 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup64.c | 3 | ||||
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 17 |
3 files changed, 22 insertions, 1 deletions
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c index b675c5add01e..2ea42ceb08f3 100644 --- a/arch/x86_64/kernel/head64.c +++ b/arch/x86_64/kernel/head64.c | |||
@@ -92,6 +92,9 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
92 | memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t)); | 92 | memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t)); |
93 | asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); | 93 | asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); |
94 | 94 | ||
95 | for (i = 0; i < NR_CPUS; i++) | ||
96 | cpu_pda(i) = &boot_cpu_pda[i]; | ||
97 | |||
95 | pda_init(0); | 98 | pda_init(0); |
96 | copy_bootdata(real_mode_data); | 99 | copy_bootdata(real_mode_data); |
97 | #ifdef CONFIG_SMP | 100 | #ifdef CONFIG_SMP |
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 66325a79ed53..6eff51e9400c 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -30,7 +30,8 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; | |||
30 | 30 | ||
31 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | 31 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
32 | 32 | ||
33 | struct x8664_pda _cpu_pda[NR_CPUS] __cacheline_aligned; | 33 | struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly; |
34 | struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned; | ||
34 | 35 | ||
35 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; | 36 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; |
36 | 37 | ||
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 4884ca12444a..c8169d066cbd 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -757,6 +757,23 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) | |||
757 | return -1; | 757 | return -1; |
758 | } | 758 | } |
759 | 759 | ||
760 | /* Allocate node local memory for AP pdas */ | ||
761 | if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) { | ||
762 | struct x8664_pda *newpda, *pda; | ||
763 | int node = cpu_to_node(cpu); | ||
764 | pda = cpu_pda(cpu); | ||
765 | newpda = kmalloc_node(sizeof (struct x8664_pda), GFP_ATOMIC, | ||
766 | node); | ||
767 | if (newpda) { | ||
768 | memcpy(newpda, pda, sizeof (struct x8664_pda)); | ||
769 | cpu_pda(cpu) = newpda; | ||
770 | } else | ||
771 | printk(KERN_ERR | ||
772 | "Could not allocate node local PDA for CPU %d on node %d\n", | ||
773 | cpu, node); | ||
774 | } | ||
775 | |||
776 | |||
760 | c_idle.idle = get_idle_for_cpu(cpu); | 777 | c_idle.idle = get_idle_for_cpu(cpu); |
761 | 778 | ||
762 | if (c_idle.idle) { | 779 | if (c_idle.idle) { |