[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081115133800.550253E6619@basil.firstfloor.org>
Date: Sat, 15 Nov 2008 14:38:00 +0100 (CET)
From: Andi Kleen <andi@...stfloor.org>
To: mingo@...e.hu, peterz@...radead.org, linux-kernel@...r.kernel.org
Subject: [PATCH REPOST] [1/3] SCHED: cache task_hot result
Minor scheduler optimization: cache the result of task_hot() in
can migrate task instead of computing it three times.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
kernel/sched.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Index: linux-2.6.28-rc4-test/kernel/sched.c
===================================================================
--- linux-2.6.28-rc4-test.orig/kernel/sched.c 2008-11-10 08:50:24.000000000 +0100
+++ linux-2.6.28-rc4-test/kernel/sched.c 2008-11-12 12:32:52.000000000 +0100
@@ -2907,6 +2907,8 @@
struct sched_domain *sd, enum cpu_idle_type idle,
int *all_pinned)
{
+ int hot;
+
/*
* We do not migrate tasks that are:
* 1) running (obviously), or
@@ -2930,10 +2932,11 @@
* 2) too many balance attempts have failed.
*/
- if (!task_hot(p, rq->clock, sd) ||
- sd->nr_balance_failed > sd->cache_nice_tries) {
+ hot = task_hot(p, rq->clock, sd);
+
+ if (!hot || sd->nr_balance_failed > sd->cache_nice_tries) {
#ifdef CONFIG_SCHEDSTATS
- if (task_hot(p, rq->clock, sd)) {
+ if (hot) {
schedstat_inc(sd, lb_hot_gained[idle]);
schedstat_inc(p, se.nr_forced_migrations);
}
@@ -2941,7 +2944,7 @@
return 1;
}
- if (task_hot(p, rq->clock, sd)) {
+ if (hot) {
schedstat_inc(p, se.nr_failed_migrations_hot);
return 0;
}
--
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