From: Ingo Molnar Date: Mon, 15 Oct 2007 15:00:13 +0000 (+0200) Subject: sched: optimize schedule() a bit on SMP X-Git-Tag: v2.6.24-rc1~1289^2~52 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e819950660e6a811b549422ffb652273257e45e;p=linux-2.6 sched: optimize schedule() a bit on SMP optimize schedule() a bit on SMP, by moving the rq-clock update outside the rq lock. code size is the same: text data bss dec hex filename 25725 2666 96 28487 6f47 sched.o.before 25725 2666 96 28487 6f47 sched.o.after Signed-off-by: Ingo Molnar Reviewed-by: Thomas Gleixner --- diff --git a/kernel/sched.c b/kernel/sched.c index e717047be5..4f13d379be 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3481,9 +3481,13 @@ need_resched_nonpreemptible: schedule_debug(prev); - spin_lock_irq(&rq->lock); - clear_tsk_need_resched(prev); + /* + * Do the rq-clock update outside the rq lock: + */ + local_irq_disable(); __update_rq_clock(rq); + spin_lock(&rq->lock); + clear_tsk_need_resched(prev); if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&