]> git.hungrycats.org Git - linux/commitdiff
- make the preempt-enable test cheaper - only test for the (very rare) TIF_NEED_RESCHED
authorIngo Molnar <mingo@elte.hu>
Wed, 13 Feb 2002 15:01:58 +0000 (16:01 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 13 Feb 2002 15:01:58 +0000 (16:01 +0100)
  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.

arch/i386/kernel/entry.S
include/linux/spinlock.h
kernel/sched.c

index c51ed2871acc21431c549500fbfce275e1329df8..cd4e793b2af94e71feb868a5b3abf26f5c392bbf 100644 (file)
@@ -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
 
index 6e3ef75fd8850acc218958252541db14409b5b15..f2c5e5e99909b4400b57039906391bb2e27efda1 100644 (file)
@@ -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)        \
index 8200108b7c67f23b45941b5dae039b1528dc0d2b..faa8bbd39781513526793466185fbf4b15c35231 100644 (file)
@@ -841,6 +841,8 @@ switch_tasks:
  */
 asmlinkage void preempt_schedule(void)
 {
+       if (unlikely(preempt_get_count()))
+               return;
        current->state = TASK_RUNNING;
        schedule();
 }