diff options
author | Benjamin LaHaise <bcrl@kvack.org> | 2009-01-10 23:00:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-10 23:05:33 -0500 |
commit | 7106a5ab89c50c6b5aadea0850b40323804a922d (patch) | |
tree | d4ce5df5ff89da035b6dd092bbe089757def7c34 /arch/x86/include/asm/system.h | |
parent | c59765042f53a79a7a65585042ff463b69cb248c (diff) |
x86-64: remove locked instruction from switch_to()
Impact: micro-optimization
The patch below removes an unnecessary locked instruction from
switch_to(). TIF_FORK is only ever set in copy_thread() on initial
process creation, and gets cleared during the first scheduling of the
process. As such, it is safe to use an unlocked test for the flag
within switch_to().
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/system.h')
-rw-r--r-- | arch/x86/include/asm/system.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 8e626ea33a1..fa47b1e6a86 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -96,15 +96,15 @@ do { \ | |||
96 | "thread_return:\n\t" \ | 96 | "thread_return:\n\t" \ |
97 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | 97 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ |
98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
99 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | ||
100 | "movq %%rax,%%rdi\n\t" \ | 99 | "movq %%rax,%%rdi\n\t" \ |
101 | "jc ret_from_fork\n\t" \ | 100 | "testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \ |
101 | "jnz ret_from_fork\n\t" \ | ||
102 | RESTORE_CONTEXT \ | 102 | RESTORE_CONTEXT \ |
103 | : "=a" (last) \ | 103 | : "=a" (last) \ |
104 | : [next] "S" (next), [prev] "D" (prev), \ | 104 | : [next] "S" (next), [prev] "D" (prev), \ |
105 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ | 105 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ |
106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
107 | [tif_fork] "i" (TIF_FORK), \ | 107 | [_tif_fork] "i" (_TIF_FORK), \ |
108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | 109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ |
110 | : "memory", "cc" __EXTRA_CLOBBER) | 110 | : "memory", "cc" __EXTRA_CLOBBER) |