diff options
| author | Heiko Carstens <[email protected]> | 2019-10-28 10:03:27 +0000 |
|---|---|---|
| committer | Vasily Gorbik <[email protected]> | 2019-10-31 16:26:48 +0000 |
| commit | 3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f (patch) | |
| tree | 7b086d413d56374438633850d74f14bf82846581 /net/unix/af_unix.c | |
| parent | s390/unwind: fix mixing regs and sp (diff) | |
| download | kernel-3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f.tar.gz kernel-3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f.zip | |
s390/idle: fix cpu idle time calculation
The idle time reported in /proc/stat sometimes incorrectly contains
huge values on s390. This is caused by a bug in arch_cpu_idle_time().
The kernel tries to figure out when a different cpu entered idle by
accessing its per-cpu data structure. There is an ordering problem: if
the remote cpu has an idle_enter value which is not zero, and an
idle_exit value which is zero, it is assumed it is idle since
"now". The "now" timestamp however is taken before the idle_enter
value is read.
Which in turn means that "now" can be smaller than idle_enter of the
remote cpu. Unconditionally subtracting idle_enter from "now" can thus
lead to a negative value (aka large unsigned value).
Fix this by moving the get_tod_clock() invocation out of the
loop. While at it also make the code a bit more readable.
A similar bug also exists for show_idle_time(). Fix this is as well.
Cc: <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions
