[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1426181043-2453-1-git-send-email-john.stultz@linaro.org>
Date: Thu, 12 Mar 2015 10:24:03 -0700
From: John Stultz <john.stultz@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: John Stultz <john.stultz@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Serge Hallyn <serge.hallyn@...onical.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Alex Thorlton <athorlton@....com>,
"vishnu.ps" <vishnu.ps@...sung.com>
Subject: [RFC][PATCH] sysinfo: Use timespec64 accessors for calculating uptime
As part of the y2038 effort, convert sysinfo's uptime calculation
to use the timespec64 based accessor.
Uptime isn't likely to ever exceed a s32, so this doesn't actually
bring much in the way of change, but it is done for consistency
sake as we deprecate 32bit internal interfaces.
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@...nvz.org>
Cc: Serge Hallyn <serge.hallyn@...onical.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Alex Thorlton <athorlton@....com>
Cc: "vishnu.ps" <vishnu.ps@...sung.com>
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
kernel/sys.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index a03d9cd..6d2d700 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2260,12 +2260,16 @@ static int do_sysinfo(struct sysinfo *info)
{
unsigned long mem_total, sav_total;
unsigned int mem_unit, bitcount;
- struct timespec tp;
+ struct timespec64 tp;
memset(info, 0, sizeof(struct sysinfo));
- get_monotonic_boottime(&tp);
- info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
+ get_monotonic_boottime64(&tp);
+ /*
+ * y2038: uptime is unlikely to ever grow beyond an s32
+ * so this cast to a long shouldn't be an issue.
+ */
+ info->uptime = (long)tp.tv_sec + (tp.tv_nsec ? 1 : 0);
get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists