lkml.org 
[lkml]   [2008]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH REPOST] [1/3] SCHED: cache task_hot result
Date

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@linux.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;
}

\
 
 \ /
  Last update: 2008-11-15 14:41    [W:0.030 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site