aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 20:22:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 20:22:44 -0500
commit4ffaf869c7780bbdfc11291e5fd4b61dde662b1c (patch)
treebdd513a1dba0c7fc99645453aef5bc7bb7343a0e /kernel
parent65131cd52b9e7c5814298e05c3b7843f13e78d24 (diff)
parent5cbd54ef470d880fc37fbe4b21eb514806d51e0d (diff)
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
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 50a21f964679..c94baf2969e7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1456,6 +1456,8 @@ static unsigned long cpu_avg_load_per_task(int cpu)
1456 1456
1457 if (rq->nr_running) 1457 if (rq->nr_running)
1458 rq->avg_load_per_task = rq->load.weight / rq->nr_running; 1458 rq->avg_load_per_task = rq->load.weight / rq->nr_running;
1459 else
1460 rq->avg_load_per_task = 0;
1459 1461
1460 return rq->avg_load_per_task; 1462 return rq->avg_load_per_task;
1461} 1463}
@@ -5868,6 +5870,8 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
5868 struct rq *rq = cpu_rq(cpu); 5870 struct rq *rq = cpu_rq(cpu);
5869 unsigned long flags; 5871 unsigned long flags;
5870 5872
5873 spin_lock_irqsave(&rq->lock, flags);
5874
5871 __sched_fork(idle); 5875 __sched_fork(idle);
5872 idle->se.exec_start = sched_clock(); 5876 idle->se.exec_start = sched_clock();
5873 5877
@@ -5875,7 +5879,6 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
5875 idle->cpus_allowed = cpumask_of_cpu(cpu); 5879 idle->cpus_allowed = cpumask_of_cpu(cpu);
5876 __set_task_cpu(idle, cpu); 5880 __set_task_cpu(idle, cpu);
5877 5881
5878 spin_lock_irqsave(&rq->lock, flags);
5879 rq->curr = rq->idle = idle; 5882 rq->curr = rq->idle = idle;
5880#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 5883#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
5881 idle->oncpu = 1; 5884 idle->oncpu = 1;