Commit b9abf404 authored by Ingo Molnar's avatar Ingo Molnar

- make the preempt-enable test cheaper - only test for the (very rare) TIF_NEED_RESCHED

  condition, we test the preemption count in preempt_schedule(). This reduces the icache
  footprint and the overhead of preemption.

- plus optimize the irq-path preemption check a bit.
parent 67176db2
...@@ -235,7 +235,9 @@ ENTRY(resume_kernel) ...@@ -235,7 +235,9 @@ ENTRY(resume_kernel)
jnz restore_all jnz restore_all
incl TI_PRE_COUNT(%ebx) incl TI_PRE_COUNT(%ebx)
sti sti
call SYMBOL_NAME(preempt_schedule) movl TI_TASK(%ebx), %ecx # ti->task
movl $0, (%ecx) # current->state = TASK_RUNNING
call SYMBOL_NAME(schedule)
jmp ret_from_intr jmp ret_from_intr
#endif #endif
......
...@@ -177,9 +177,8 @@ do { \ ...@@ -177,9 +177,8 @@ do { \
do { \ do { \
--current_thread_info()->preempt_count; \ --current_thread_info()->preempt_count; \
barrier(); \ barrier(); \
if (unlikely(!(current_thread_info()->preempt_count) && \ if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
test_thread_flag(TIF_NEED_RESCHED))) \ preempt_schedule(); \
preempt_schedule(); \
} while (0) } while (0)
#define spin_lock(lock) \ #define spin_lock(lock) \
......
...@@ -841,6 +841,8 @@ asmlinkage void schedule(void) ...@@ -841,6 +841,8 @@ asmlinkage void schedule(void)
*/ */
asmlinkage void preempt_schedule(void) asmlinkage void preempt_schedule(void)
{ {
if (unlikely(preempt_get_count()))
return;
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
schedule(); schedule();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment