diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-10-28 12:15:32 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-10-31 09:52:52 +0100 |
commit | 4560e7c3317c7a2b370e36dadd3a3bac2ed70818 (patch) | |
tree | b0fd4d8705f388783dd893a472105013b702991d /arch/s390/kernel/vtime.c | |
parent | 7ab64a85e1a009046f97413a573e83fd85f7804d (diff) | |
download | linux-4560e7c3317c7a2b370e36dadd3a3bac2ed70818.tar.bz2 |
s390/vtime: correct idle time calculation
Use the ACCESS_ONCE macro for both accesses to idle->sequence in the
loops to calculate the idle time. If only one access uses the macro,
the compiler is free to cache the value for the second access which
can cause endless loops.
Cc: stable@vger.kernel.org # 3.6+
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/vtime.c')
-rw-r--r-- | arch/s390/kernel/vtime.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index e312c48a1c40..8c34363d6f1e 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c @@ -191,7 +191,7 @@ cputime64_t s390_get_idle_time(int cpu) sequence = ACCESS_ONCE(idle->sequence); idle_enter = ACCESS_ONCE(idle->clock_idle_enter); idle_exit = ACCESS_ONCE(idle->clock_idle_exit); - } while ((sequence & 1) || (idle->sequence != sequence)); + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence)); return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0; } |