diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-18 10:38:58 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-18 10:38:58 -0500 |
commit | c6f5e0acd5d12ee23f701f15889872e67b47caa6 (patch) | |
tree | a4613618f06d7519f954745b893b4f572ecd39d9 /arch/x86/kernel | |
parent | ea9279066de44053d0c20ea855bc9f4706652d84 (diff) |
x86-64: Move current task from PDA to per-cpu and consolidate with 32-bit.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/asm-offsets_64.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/dumpstack_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 3 |
5 files changed, 7 insertions, 9 deletions
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index cae6697c0991..4f7a210e1e58 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -51,7 +51,6 @@ int main(void) | |||
51 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) | 51 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) |
52 | ENTRY(kernelstack); | 52 | ENTRY(kernelstack); |
53 | ENTRY(oldrsp); | 53 | ENTRY(oldrsp); |
54 | ENTRY(pcurrent); | ||
55 | ENTRY(irqcount); | 54 | ENTRY(irqcount); |
56 | DEFINE(pda_size, sizeof(struct x8664_pda)); | 55 | DEFINE(pda_size, sizeof(struct x8664_pda)); |
57 | BLANK(); | 56 | BLANK(); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4221e920886d..b50e38d16888 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -903,10 +903,7 @@ void __cpuinit pda_init(int cpu) | |||
903 | pda->kernelstack = (unsigned long)stack_thread_info() - | 903 | pda->kernelstack = (unsigned long)stack_thread_info() - |
904 | PDA_STACKOFFSET + THREAD_SIZE; | 904 | PDA_STACKOFFSET + THREAD_SIZE; |
905 | 905 | ||
906 | if (cpu == 0) { | 906 | if (cpu != 0) { |
907 | /* others are initialized in smpboot.c */ | ||
908 | pda->pcurrent = &init_task; | ||
909 | } else { | ||
910 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | 907 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) |
911 | pda->nodenumber = cpu_to_node(cpu); | 908 | pda->nodenumber = cpu_to_node(cpu); |
912 | } | 909 | } |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 28e26a4315df..d35db5993fd6 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -242,7 +242,7 @@ void show_registers(struct pt_regs *regs) | |||
242 | int i; | 242 | int i; |
243 | unsigned long sp; | 243 | unsigned long sp; |
244 | const int cpu = smp_processor_id(); | 244 | const int cpu = smp_processor_id(); |
245 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; | 245 | struct task_struct *cur = current; |
246 | 246 | ||
247 | sp = regs->sp; | 247 | sp = regs->sp; |
248 | printk("CPU %d ", cpu); | 248 | printk("CPU %d ", cpu); |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 416fb9282f4f..e00c31a4b3c0 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -57,6 +57,9 @@ | |||
57 | 57 | ||
58 | asmlinkage extern void ret_from_fork(void); | 58 | asmlinkage extern void ret_from_fork(void); |
59 | 59 | ||
60 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; | ||
61 | EXPORT_PER_CPU_SYMBOL(current_task); | ||
62 | |||
60 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; | 63 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; |
61 | 64 | ||
62 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); | 65 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); |
@@ -615,7 +618,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
615 | */ | 618 | */ |
616 | prev->usersp = read_pda(oldrsp); | 619 | prev->usersp = read_pda(oldrsp); |
617 | write_pda(oldrsp, next->usersp); | 620 | write_pda(oldrsp, next->usersp); |
618 | write_pda(pcurrent, next_p); | 621 | percpu_write(current_task, next_p); |
619 | 622 | ||
620 | write_pda(kernelstack, | 623 | write_pda(kernelstack, |
621 | (unsigned long)task_stack_page(next_p) + | 624 | (unsigned long)task_stack_page(next_p) + |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2f0e0f1090f6..5854be0fb804 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -790,13 +790,12 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
790 | 790 | ||
791 | set_idle_for_cpu(cpu, c_idle.idle); | 791 | set_idle_for_cpu(cpu, c_idle.idle); |
792 | do_rest: | 792 | do_rest: |
793 | #ifdef CONFIG_X86_32 | ||
794 | per_cpu(current_task, cpu) = c_idle.idle; | 793 | per_cpu(current_task, cpu) = c_idle.idle; |
794 | #ifdef CONFIG_X86_32 | ||
795 | init_gdt(cpu); | 795 | init_gdt(cpu); |
796 | /* Stack for startup_32 can be just as for start_secondary onwards */ | 796 | /* Stack for startup_32 can be just as for start_secondary onwards */ |
797 | irq_ctx_init(cpu); | 797 | irq_ctx_init(cpu); |
798 | #else | 798 | #else |
799 | cpu_pda(cpu)->pcurrent = c_idle.idle; | ||
800 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 799 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); |
801 | initial_gs = per_cpu_offset(cpu); | 800 | initial_gs = per_cpu_offset(cpu); |
802 | #endif | 801 | #endif |