]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.2-stable patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Jan 2012 18:04:23 +0000 (10:04 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Jan 2012 18:04:23 +0000 (10:04 -0800)
added patches:
fix-cputime-overflow-in-uptime_proc_show.patch

queue-3.2/fix-cputime-overflow-in-uptime_proc_show.patch [new file with mode: 0644]
queue-3.2/series

diff --git a/queue-3.2/fix-cputime-overflow-in-uptime_proc_show.patch b/queue-3.2/fix-cputime-overflow-in-uptime_proc_show.patch
new file mode 100644 (file)
index 0000000..463a832
--- /dev/null
@@ -0,0 +1,47 @@
+From c3e0ef9a298e028a82ada28101ccd5cf64d209ee Mon Sep 17 00:00:00 2001
+From: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Date: Thu, 15 Dec 2011 14:56:10 +0100
+Subject: [S390] fix cputime overflow in uptime_proc_show
+
+From: Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+commit c3e0ef9a298e028a82ada28101ccd5cf64d209ee upstream.
+
+For 32-bit architectures using standard jiffies the idletime calculation
+in uptime_proc_show will quickly overflow. It takes (2^32 / HZ) seconds
+of idle-time, or e.g. 12.45 days with no load on a quad-core with HZ=1000.
+Switch to 64-bit calculations.
+
+Cc: Michael Abbott <michael.abbott@diamond.ac.uk>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/proc/uptime.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/fs/proc/uptime.c
++++ b/fs/proc/uptime.c
+@@ -11,15 +11,20 @@ static int uptime_proc_show(struct seq_f
+ {
+       struct timespec uptime;
+       struct timespec idle;
++      cputime64_t idletime;
++      u64 nsec;
++      u32 rem;
+       int i;
+-      cputime_t idletime = cputime_zero;
++      idletime = 0;
+       for_each_possible_cpu(i)
+               idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
+       do_posix_clock_monotonic_gettime(&uptime);
+       monotonic_to_bootbased(&uptime);
+-      cputime_to_timespec(idletime, &idle);
++      nsec = cputime64_to_jiffies64(idletime) * TICK_NSEC;
++      idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
++      idle.tv_nsec = rem;
+       seq_printf(m, "%lu.%02lu %lu.%02lu\n",
+                       (unsigned long) uptime.tv_sec,
+                       (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
index 37b6c9343c04de9b958b208b4ee368366e0b3a97..3045f8af5b5a6ad72a59acce2eb08cc81d9158a2 100644 (file)
@@ -86,3 +86,4 @@ hid-hid-multitouch-add-support-for-new-hanvon-panels.patch
 hid-multitouch-add-support-of-atmel-multitouch-panels.patch
 hid-multitouch-add-support-for-3m-32.patch
 hid-hid-multitouch-add-support-9-new-xiroku-devices.patch
+fix-cputime-overflow-in-uptime_proc_show.patch