Commit 7e063818 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

[PATCH] schedstat: fix schedule() statistics

The number of times schedule() left the processor idle in the
/proc/schedstat (runqueue.sched_goidle) seems to be wrong.

The schedule() statistics should satisfy the equation:
	sched_cnt == sched_noswitch + sched_switch + sched_goidle

(http://eaglet.rain.com/rick/linux/schedstat/v10/format-10.html)

The below patch fix this, and I have confirmed to be fixed with:
	# grep ^cpu /proc/schedstat | awk '{print $6+$7+$9, $8}'
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 83e2ae7f
......@@ -2574,7 +2574,6 @@ asmlinkage void __sched schedule(void)
}
} else {
if (dependent_sleeper(cpu, rq)) {
schedstat_inc(rq, sched_goidle);
next = rq->idle;
goto switch_tasks;
}
......@@ -2618,6 +2617,8 @@ asmlinkage void __sched schedule(void)
}
next->activated = 0;
switch_tasks:
if (next == rq->idle)
schedstat_inc(rq, sched_goidle);
prefetch(next);
clear_tsk_need_resched(prev);
rcu_qsctr_inc(task_cpu(prev));
......
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