Commit ff743345 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: remove extra call overhead for schedule()

Lai Jiangshan's patch reminded me that I promised Nick to remove
that extra call overhead in schedule().
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090313112300.927414207@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 13318a71
...@@ -248,7 +248,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, ...@@ -248,7 +248,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
/* didnt get the lock, go to sleep: */ /* didnt get the lock, go to sleep: */
spin_unlock_mutex(&lock->wait_lock, flags); spin_unlock_mutex(&lock->wait_lock, flags);
__schedule(); preempt_enable_no_resched();
schedule();
preempt_disable();
spin_lock_mutex(&lock->wait_lock, flags); spin_lock_mutex(&lock->wait_lock, flags);
} }
......
...@@ -5131,13 +5131,15 @@ pick_next_task(struct rq *rq) ...@@ -5131,13 +5131,15 @@ pick_next_task(struct rq *rq)
/* /*
* schedule() is the main scheduler function. * schedule() is the main scheduler function.
*/ */
asmlinkage void __sched __schedule(void) asmlinkage void __sched schedule(void)
{ {
struct task_struct *prev, *next; struct task_struct *prev, *next;
unsigned long *switch_count; unsigned long *switch_count;
struct rq *rq; struct rq *rq;
int cpu; int cpu;
need_resched:
preempt_disable();
cpu = smp_processor_id(); cpu = smp_processor_id();
rq = cpu_rq(cpu); rq = cpu_rq(cpu);
rcu_qsctr_inc(cpu); rcu_qsctr_inc(cpu);
...@@ -5194,15 +5196,9 @@ asmlinkage void __sched __schedule(void) ...@@ -5194,15 +5196,9 @@ asmlinkage void __sched __schedule(void)
if (unlikely(reacquire_kernel_lock(current) < 0)) if (unlikely(reacquire_kernel_lock(current) < 0))
goto need_resched_nonpreemptible; goto need_resched_nonpreemptible;
}
asmlinkage void __sched schedule(void)
{
need_resched:
preempt_disable();
__schedule();
preempt_enable_no_resched(); preempt_enable_no_resched();
if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) if (need_resched())
goto need_resched; goto need_resched;
} }
EXPORT_SYMBOL(schedule); EXPORT_SYMBOL(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