Commit 4ffaf869 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'sched-fixes-for-linus' of...

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
parents 65131cd5 5cbd54ef
...@@ -1456,6 +1456,8 @@ static unsigned long cpu_avg_load_per_task(int cpu) ...@@ -1456,6 +1456,8 @@ static unsigned long cpu_avg_load_per_task(int cpu)
if (rq->nr_running) if (rq->nr_running)
rq->avg_load_per_task = rq->load.weight / 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; return rq->avg_load_per_task;
} }
...@@ -5868,6 +5870,8 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) ...@@ -5868,6 +5870,8 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
struct rq *rq = cpu_rq(cpu); struct rq *rq = cpu_rq(cpu);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&rq->lock, flags);
__sched_fork(idle); __sched_fork(idle);
idle->se.exec_start = sched_clock(); idle->se.exec_start = sched_clock();
...@@ -5875,7 +5879,6 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) ...@@ -5875,7 +5879,6 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
idle->cpus_allowed = cpumask_of_cpu(cpu); idle->cpus_allowed = cpumask_of_cpu(cpu);
__set_task_cpu(idle, cpu); __set_task_cpu(idle, cpu);
spin_lock_irqsave(&rq->lock, flags);
rq->curr = rq->idle = idle; rq->curr = rq->idle = idle;
#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
idle->oncpu = 1; idle->oncpu = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment