aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_32.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2014-02-06 09:41:31 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2014-03-06 19:56:55 -0500
commit198d208df4371734ac4728f69cb585c284d20a15 (patch)
treef5a3f120d02678987f35d272653bef6a6d02efe5 /arch/x86/kernel/process_32.c
parent0788aa6a23cb9d693fc5040ec774b979f1e906cd (diff)
x86: Keep thread_info on thread stack in x86_32
x86_64 uses a per_cpu variable kernel_stack to always point to the thread stack of current. This is where the thread_info is stored and is accessed from this location even when the irq or exception stack is in use. This removes the complexity of having to maintain the thread info on the stack when interrupts are running and having to copy the preempt_count and other fields to the interrupt stack. x86_32 uses the old method of copying the thread_info from the thread stack to the exception stack just before executing the exception. Having the two different requires #ifdefs and also the x86_32 way is a bit of a pain to maintain. By converting x86_32 to the same method of x86_64, we can remove #ifdefs, clean up the x86_32 code a little, and remove the overhead of the copy. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Brian Gerst <brgerst@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20110806012354.263834829@goodmis.org Link: http://lkml.kernel.org/r/20140206144321.852942014@goodmis.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r--arch/x86/kernel/process_32.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 0de43e98ce08..7bc86bbe7485 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -314,6 +314,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
314 */ 314 */
315 arch_end_context_switch(next_p); 315 arch_end_context_switch(next_p);
316 316
317 this_cpu_write(kernel_stack,
318 (unsigned long)task_stack_page(next_p) +
319 THREAD_SIZE - KERNEL_STACK_OFFSET);
320
317 /* 321 /*
318 * Restore %gs if needed (which is common) 322 * Restore %gs if needed (which is common)
319 */ 323 */