diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-12-22 14:03:29 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-23 12:54:37 -0800 |
commit | f16b34aa13e8c55085f346bcf07afb2312c56c0a (patch) | |
tree | 4fba40d99a5907694a1a1de8023f1431204f4f98 /arch | |
parent | cc295d0e95063809af31971e4aec1d809247f13b (diff) | |
download | linux-f16b34aa13e8c55085f346bcf07afb2312c56c0a.tar.bz2 |
lib: proportion: fix underflow in prop_norm_percpu()
Zhe Jiang noticed that its possible to underflow pl->events in
prop_norm_percpu() when the value returned by percpu_counter_read() is less
than the error on that read and the period delay > 1. In that case half might
not trigger the batch increment and the value will be identical on the next
iteration, causing the same half to be subtracted again and again.
Fix this by rewriting the division as a single subtraction instead of a
subtraction loop and using percpu_counter_sum() when the value returned by
percpu_counter_read() is smaller than the error.
The latter is still needed if we want pl->events to shrink properly in the
error region.
[akpm@linux-foundation.org: cleanups]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: Jiang Zhe <zhe.jiang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions