public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] uptime: Convert uptime to use 64bit time accessor
@ 2015-03-12 17:24 John Stultz
  2015-03-12 17:42 ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: John Stultz @ 2015-03-12 17:24 UTC (permalink / raw)
  To: lkml; +Cc: John Stultz, Arnd Bergmann, Rik van Riel, Frederic Weisbecker

Convert the uptime output to use the timespec64 structure.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 fs/proc/uptime.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index 33de567..a0b262f 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -9,7 +9,7 @@
 
 static int uptime_proc_show(struct seq_file *m, void *v)
 {
-	struct timespec uptime;
+	struct timespec64 uptime;
 	struct timespec idle;
 	u64 idletime;
 	u64 nsec;
@@ -20,12 +20,12 @@ static int uptime_proc_show(struct seq_file *m, void *v)
 	for_each_possible_cpu(i)
 		idletime += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];
 
-	get_monotonic_boottime(&uptime);
+	get_monotonic_boottime64(&uptime);
 	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,
+	seq_printf(m, "%llu.%02lu %lu.%02lu\n",
+			(unsigned long long) uptime.tv_sec,
 			(uptime.tv_nsec / (NSEC_PER_SEC / 100)),
 			(unsigned long) idle.tv_sec,
 			(idle.tv_nsec / (NSEC_PER_SEC / 100)));
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH] uptime: Convert uptime to use 64bit time accessor
  2015-03-12 17:24 [RFC][PATCH] uptime: Convert uptime to use 64bit time accessor John Stultz
@ 2015-03-12 17:42 ` Frederic Weisbecker
  2015-03-12 18:03   ` John Stultz
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2015-03-12 17:42 UTC (permalink / raw)
  To: John Stultz; +Cc: lkml, Arnd Bergmann, Rik van Riel


On Thu, Mar 12, 2015 at 10:24:17AM -0700, John Stultz wrote:
> Convert the uptime output to use the timespec64 structure.

That looks correct but the changelog lacks a reason :-)
 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  fs/proc/uptime.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
> index 33de567..a0b262f 100644
> --- a/fs/proc/uptime.c
> +++ b/fs/proc/uptime.c
> @@ -9,7 +9,7 @@
>  
>  static int uptime_proc_show(struct seq_file *m, void *v)
>  {
> -	struct timespec uptime;
> +	struct timespec64 uptime;
>  	struct timespec idle;
>  	u64 idletime;
>  	u64 nsec;
> @@ -20,12 +20,12 @@ static int uptime_proc_show(struct seq_file *m, void *v)
>  	for_each_possible_cpu(i)
>  		idletime += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];
>  
> -	get_monotonic_boottime(&uptime);
> +	get_monotonic_boottime64(&uptime);
>  	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,
> +	seq_printf(m, "%llu.%02lu %lu.%02lu\n",
> +			(unsigned long long) uptime.tv_sec,
>  			(uptime.tv_nsec / (NSEC_PER_SEC / 100)),
>  			(unsigned long) idle.tv_sec,
>  			(idle.tv_nsec / (NSEC_PER_SEC / 100)));
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH] uptime: Convert uptime to use 64bit time accessor
  2015-03-12 17:42 ` Frederic Weisbecker
@ 2015-03-12 18:03   ` John Stultz
  0 siblings, 0 replies; 3+ messages in thread
From: John Stultz @ 2015-03-12 18:03 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: lkml, Arnd Bergmann, Rik van Riel

On Thu, Mar 12, 2015 at 10:42 AM, Frederic Weisbecker
<fweisbec@gmail.com> wrote:
>
> On Thu, Mar 12, 2015 at 10:24:17AM -0700, John Stultz wrote:
>> Convert the uptime output to use the timespec64 structure.
>
> That looks correct but the changelog lacks a reason :-)

Yes, sorry. I'll add a better rational to the next revision.
thanks
-john

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-12 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 17:24 [RFC][PATCH] uptime: Convert uptime to use 64bit time accessor John Stultz
2015-03-12 17:42 ` Frederic Weisbecker
2015-03-12 18:03   ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox