Commit b97d6747 authored by Luis Claudio R. Goncalves's avatar Luis Claudio R. Goncalves Committed by Thomas Gleixner

sched: Fix spurious load spikes

Fixes spurious system load spikes observed in /proc/loadavgrt, as described in:

  Bug 253103: /proc/loadavgrt issues weird results
  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=253103Signed-off-by: default avatarLuis Claudio R. Goncalves <lgoncalv@redhat.com&gt;>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 59f677c0
...@@ -3115,6 +3115,13 @@ unsigned long nr_iowait(void) ...@@ -3115,6 +3115,13 @@ unsigned long nr_iowait(void)
for_each_possible_cpu(i) for_each_possible_cpu(i)
sum += atomic_read(&cpu_rq(i)->nr_iowait); sum += atomic_read(&cpu_rq(i)->nr_iowait);
/*
* Since we read the counters lockless, it might be slightly
* inaccurate. Do not allow it to go below zero though:
*/
if (unlikely((long)sum < 0))
sum = 0;
return sum; return sum;
} }
......
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