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)
jnz restore_all
incl TI_PRE_COUNT(%ebx)
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
#endif
......
......@@ -177,9 +177,8 @@ do { \
do { \
--current_thread_info()->preempt_count; \
barrier(); \
if (unlikely(!(current_thread_info()->preempt_count) && \
test_thread_flag(TIF_NEED_RESCHED))) \
preempt_schedule(); \
if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
preempt_schedule(); \
} while (0)
#define spin_lock(lock) \
......
......@@ -841,6 +841,8 @@ asmlinkage void schedule(void)
*/
asmlinkage void preempt_schedule(void)
{
if (unlikely(preempt_get_count()))
return;
current->state = TASK_RUNNING;
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