[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <47480F2D.3030408@suse.de>
Date: Sat, 24 Nov 2007 17:16:53 +0530
From: Nikanth Karthikesan <knikanth@...e.de>
To: mingo@...e.hu
Cc: dmitry.adamushko@...il.com, a.p.zijlstra@...llo.nl,
linux-kernel@...r.kernel.org, vatsa@...ux.vnet.ibm.com
Subject: [PATCH] sched: minor optimization
As an optimization, if all tasks are in the fair class, the next task is
directly picked from fair_sched_class. But, if it returns no task we go
through again from sched_class_highest which could be avoided and
instead return the idle task directly.
Signed-off-by : Nikanth Karthikesan <knikanth@...e.de>
---
kernel/sched.c | 2 ++
1 file changed, 2 insertions(+)
Index: b/kernel/sched.c
===================================================================
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3449,6 +3449,8 @@ pick_next_task(struct rq *rq, struct tas
p = fair_sched_class.pick_next_task(rq);
if (likely(p))
return p;
+ else /* rq->nr_running is zero */
+ return idle_sched_class.pick_next_task(rq);
}
class = sched_class_highest;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists