summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 17:22:44 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 17:22:44 -0800
commit4ffaf869c7780bbdfc11291e5fd4b61dde662b1c (patch)
treebdd513a1dba0c7fc99645453aef5bc7bb7343a0e
parent65131cd52b9e7c5814298e05c3b7843f13e78d24 (diff)
parent5cbd54ef470d880fc37fbe4b21eb514806d51e0d (diff)
downloadop-kernel-dev-4ffaf869c7780bbdfc11291e5fd4b61dde662b1c.zip
op-kernel-dev-4ffaf869c7780bbdfc11291e5fd4b61dde662b1c.tar.gz
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: sched: fix init_idle()'s use of sched_clock() sched: fix stale value in average load per task
-rw-r--r--kernel/sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 50a21f9..c94baf2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1456,6 +1456,8 @@ static unsigned long cpu_avg_load_per_task(int cpu)
if (rq->nr_running)
rq->avg_load_per_task = rq->load.weight / rq->nr_running;
+ else
+ rq->avg_load_per_task = 0;
return rq->avg_load_per_task;
}
@@ -5868,6 +5870,8 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
struct rq *rq = cpu_rq(cpu);
unsigned long flags;
+ spin_lock_irqsave(&rq->lock, flags);
+
__sched_fork(idle);
idle->se.exec_start = sched_clock();
@@ -5875,7 +5879,6 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
idle->cpus_allowed = cpumask_of_cpu(cpu);
__set_task_cpu(idle, cpu);
- spin_lock_irqsave(&rq->lock, flags);
rq->curr = rq->idle = idle;
#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
idle->oncpu = 1;
OpenPOWER on IntegriCloud