diff options
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r-- | arch/x86/kernel/process_64.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 416fb9282f4f..4523ff88a69d 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -57,6 +57,12 @@ | |||
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 | |||
63 | DEFINE_PER_CPU(unsigned long, old_rsp); | ||
64 | static DEFINE_PER_CPU(unsigned char, is_idle); | ||
65 | |||
60 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; | 66 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; |
61 | 67 | ||
62 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); | 68 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); |
@@ -75,13 +81,13 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister); | |||
75 | 81 | ||
76 | void enter_idle(void) | 82 | void enter_idle(void) |
77 | { | 83 | { |
78 | write_pda(isidle, 1); | 84 | percpu_write(is_idle, 1); |
79 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); | 85 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); |
80 | } | 86 | } |
81 | 87 | ||
82 | static void __exit_idle(void) | 88 | static void __exit_idle(void) |
83 | { | 89 | { |
84 | if (test_and_clear_bit_pda(0, isidle) == 0) | 90 | if (x86_test_and_clear_bit_percpu(0, is_idle) == 0) |
85 | return; | 91 | return; |
86 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); | 92 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); |
87 | } | 93 | } |
@@ -392,7 +398,7 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) | |||
392 | load_gs_index(0); | 398 | load_gs_index(0); |
393 | regs->ip = new_ip; | 399 | regs->ip = new_ip; |
394 | regs->sp = new_sp; | 400 | regs->sp = new_sp; |
395 | write_pda(oldrsp, new_sp); | 401 | percpu_write(old_rsp, new_sp); |
396 | regs->cs = __USER_CS; | 402 | regs->cs = __USER_CS; |
397 | regs->ss = __USER_DS; | 403 | regs->ss = __USER_DS; |
398 | regs->flags = 0x200; | 404 | regs->flags = 0x200; |
@@ -613,13 +619,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
613 | /* | 619 | /* |
614 | * Switch the PDA and FPU contexts. | 620 | * Switch the PDA and FPU contexts. |
615 | */ | 621 | */ |
616 | prev->usersp = read_pda(oldrsp); | 622 | prev->usersp = percpu_read(old_rsp); |
617 | write_pda(oldrsp, next->usersp); | 623 | percpu_write(old_rsp, next->usersp); |
618 | write_pda(pcurrent, next_p); | 624 | percpu_write(current_task, next_p); |
619 | 625 | ||
620 | write_pda(kernelstack, | 626 | percpu_write(kernel_stack, |
621 | (unsigned long)task_stack_page(next_p) + | 627 | (unsigned long)task_stack_page(next_p) + |
622 | THREAD_SIZE - PDA_STACKOFFSET); | 628 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
623 | #ifdef CONFIG_CC_STACKPROTECTOR | 629 | #ifdef CONFIG_CC_STACKPROTECTOR |
624 | write_pda(stack_canary, next_p->stack_canary); | 630 | write_pda(stack_canary, next_p->stack_canary); |
625 | /* | 631 | /* |