diff options
author | Joe Korty <joe.korty@ccur.com> | 2008-08-25 17:15:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-26 04:37:46 -0400 |
commit | 2189459d25a47401c69a17794c9d390c890351f9 (patch) | |
tree | 1e22875e4b4fd29e2af5e8078f5d82f814cc56fd /kernel/lockdep_proc.c | |
parent | 83097aca8567a0bd593534853b71fe0fa9a75d69 (diff) |
lockstat: fix numerical output rounding error
Fix rounding error in /proc/lock_stat numerical output.
On occasion the two digit fractional part contains the three
digit value '100'. This is due to a bug in the rounding algorithm
which pushes values in the range '95..99' to '100' rather than
to '00' + an increment to the integer part. For example,
- 123456.100 old display
+ 123457.00 new display
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/lockdep_proc.c')
-rw-r--r-- | kernel/lockdep_proc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c index 4b194d34d77..20dbcbf9c7d 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/lockdep_proc.c | |||
@@ -472,8 +472,9 @@ static void snprint_time(char *buf, size_t bufsiz, s64 nr) | |||
472 | { | 472 | { |
473 | unsigned long rem; | 473 | unsigned long rem; |
474 | 474 | ||
475 | nr += 5; /* for display rounding */ | ||
475 | rem = do_div(nr, 1000); /* XXX: do_div_signed */ | 476 | rem = do_div(nr, 1000); /* XXX: do_div_signed */ |
476 | snprintf(buf, bufsiz, "%lld.%02d", (long long)nr, ((int)rem+5)/10); | 477 | snprintf(buf, bufsiz, "%lld.%02d", (long long)nr, (int)rem/10); |
477 | } | 478 | } |
478 | 479 | ||
479 | static void seq_time(struct seq_file *m, s64 time) | 480 | static void seq_time(struct seq_file *m, s64 time) |