diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2012-06-22 09:52:09 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-07-05 14:58:13 -0400 |
| commit | 5167e8d5417bf5c322a703d2927daec727ea40dd (patch) | |
| tree | b919aac933c104e7c7abc1730da810f60ba3229d /kernel/time | |
| parent | 164c33c6adee609b8b9062cce4c10f764d0dce13 (diff) | |
sched/nohz: Rewrite and fix load-avg computation -- again
Thanks to Charles Wang for spotting the defects in the current code:
- If we go idle during the sample window -- after sampling, we get a
negative bias because we can negate our own sample.
- If we wake up during the sample window we get a positive bias
because we push the sample to a known active period.
So rewrite the entire nohz load-avg muck once again, now adding
copious documentation to the code.
Reported-and-tested-by: Doug Smythies <dsmythies@telus.net>
Reported-and-tested-by: Charles Wang <muming.wq@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org
Link: http://lkml.kernel.org/r/1340373782.18025.74.camel@twins
[ minor edits ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/tick-sched.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 869997833928..4a08472c3ca7 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -406,6 +406,7 @@ static void tick_nohz_stop_sched_tick(struct tick_sched *ts) | |||
| 406 | */ | 406 | */ |
| 407 | if (!ts->tick_stopped) { | 407 | if (!ts->tick_stopped) { |
| 408 | select_nohz_load_balancer(1); | 408 | select_nohz_load_balancer(1); |
| 409 | calc_load_enter_idle(); | ||
| 409 | 410 | ||
| 410 | ts->idle_tick = hrtimer_get_expires(&ts->sched_timer); | 411 | ts->idle_tick = hrtimer_get_expires(&ts->sched_timer); |
| 411 | ts->tick_stopped = 1; | 412 | ts->tick_stopped = 1; |
| @@ -597,6 +598,7 @@ void tick_nohz_idle_exit(void) | |||
| 597 | account_idle_ticks(ticks); | 598 | account_idle_ticks(ticks); |
| 598 | #endif | 599 | #endif |
| 599 | 600 | ||
| 601 | calc_load_exit_idle(); | ||
| 600 | touch_softlockup_watchdog(); | 602 | touch_softlockup_watchdog(); |
| 601 | /* | 603 | /* |
| 602 | * Cancel the scheduled timer and restore the tick | 604 | * Cancel the scheduled timer and restore the tick |
