Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570291

[PATCH RESEND 05/36] macintosh/rack-meter: Remove cputime_t internal use

From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject [PATCH RESEND 05/36] macintosh/rack-meter: Remove cputime_t internal use
Date 2017-01-31 04:40 +0100
Message-ID <t5xsu-437-11@gated-at.bofh.it> (permalink)
References <t5x97-3Wp-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


cputime_t is being obsolete and replaced by nsecs units.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 drivers/macintosh/rack-meter.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index c114594..e199fd6 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -52,8 +52,8 @@ struct rackmeter_dma {
 struct rackmeter_cpu {
 	struct delayed_work	sniffer;
 	struct rackmeter	*rm;
-	cputime64_t		prev_wall;
-	cputime64_t		prev_idle;
+	u64			prev_wall;
+	u64			prev_idle;
 	int			zero;
 } ____cacheline_aligned;
 
@@ -81,7 +81,7 @@ static int rackmeter_ignore_nice;
 /* This is copied from cpufreq_ondemand, maybe we should put it in
  * a common header somewhere
  */
-static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
+static inline u64 get_cpu_idle_time(unsigned int cpu)
 {
 	u64 retval;
 
@@ -91,7 +91,7 @@ static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
 	if (rackmeter_ignore_nice)
 		retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
 
-	return nsecs_to_cputime64(retval);
+	return retval;
 }
 
 static void rackmeter_setup_i2s(struct rackmeter *rm)
@@ -217,23 +217,23 @@ static void rackmeter_do_timer(struct work_struct *work)
 		container_of(work, struct rackmeter_cpu, sniffer.work);
 	struct rackmeter *rm = rcpu->rm;
 	unsigned int cpu = smp_processor_id();
-	cputime64_t cur_jiffies, total_idle_ticks;
-	unsigned int total_ticks, idle_ticks;
+	u64 cur_nsecs, total_idle_nsecs;
+	u64 total_nsecs, idle_nsecs;
 	int i, offset, load, cumm, pause;
 
-	cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
-	total_ticks = (unsigned int) (cur_jiffies - rcpu->prev_wall);
-	rcpu->prev_wall = cur_jiffies;
+	cur_nsecs = jiffies64_to_nsecs(get_jiffies_64());
+	total_nsecs = cur_nsecs - rcpu->prev_wall;
+	rcpu->prev_wall = cur_nsecs;
 
-	total_idle_ticks = get_cpu_idle_time(cpu);
-	idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
-	idle_ticks = min(idle_ticks, total_ticks);
-	rcpu->prev_idle = total_idle_ticks;
+	total_idle_nsecs = get_cpu_idle_time(cpu);
+	idle_nsecs = total_idle_nsecs - rcpu->prev_idle;
+	idle_nsecs = min(idle_nsecs, total_nsecs);
+	rcpu->prev_idle = total_idle_nsecs;
 
 	/* We do a very dumb calculation to update the LEDs for now,
 	 * we'll do better once we have actual PWM implemented
 	 */
-	load = (9 * (total_ticks - idle_ticks)) / total_ticks;
+	load = div64_u64(9 * (total_nsecs - idle_nsecs), total_nsecs);
 
 	offset = cpu << 3;
 	cumm = 0;
@@ -278,7 +278,7 @@ static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)
 			continue;
 		rcpu = &rm->cpu[cpu];
 		rcpu->prev_idle = get_cpu_idle_time(cpu);
-		rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64());
+		rcpu->prev_wall = jiffies64_to_nsecs(get_jiffies_64());
 		schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer,
 					 msecs_to_jiffies(CPU_SAMPLING_RATE));
 	}
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL] cputime: Convert core use of cputime_t to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-30 05:50 +0100
  Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Stanislaw Gruszka <sgruszka@redhat.com> - 2017-01-30 15:40 +0100
    Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-30 16:10 +0100
      Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Stanislaw Gruszka <sgruszka@redhat.com> - 2017-01-30 17:00 +0100
  [PATCH RESEND 01/36] jiffies: Reuse TICK_NSEC instead of NSEC_PER_JIFFY Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:20 +0100
    [PATCH RESEND 04/36] cputime: Convert kcpustat to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] sched/cputime: Convert kcpustat to nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 24/36] cputime: Push time to account_idle_time() in nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] sched/cputime: Push time to account_idle_time() in  nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 25/36] cputime: Push time to account_system_time() in nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] sched/cputime: Push time to account_system_time()  in nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 16/36] signal: Convert obsolete cputime type to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] signal: Convert obsolete cputime type to nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 27/36] vtime: Return nsecs instead of cputime_t to account Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] sched/cputime, vtime: Return nsecs instead of  cputime_t to account tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 09/36] alpha: Convert obsolete cputime_t to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] alpha: Convert obsolete cputime_t to nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 12/36] binfmt: Convert obsolete cputime type to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:30 +0100
      [tip:sched/core] fs/binfmt: Convert obsolete cputime type to nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 30/36] ia64: Convert vtime to use nsec units directly Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:40 +0100
      [tip:sched/core] ia64: Convert vtime to use nsec units directly tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 05/36] macintosh/rack-meter: Remove cputime_t internal use Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:40 +0100
      [tip:sched/core] macintosh/rack-meter: Convert cputime64_t use to  u64 tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 12:00 +0100
    [PATCH RESEND 07/36] cputime: Special API to return old-typed cputime Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:40 +0100
      [tip:sched/core] sched/cputime: Introduce special task_cputime_t()  API to return old-typed cputime tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 02/36] time: Introduce jiffies64_to_nsecs() Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:50 +0100
      [tip:sched/core] time: Introduce jiffies64_to_nsecs() tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 26/36] cputime: Complete nsec conversion of tick based accounting Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:50 +0100
      [tip:sched/core] sched/cputime: Complete nsec conversion of tick  based accounting tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 17/36] cputime: Increment kcpustat directly on irqtime account Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 04:50 +0100
      [tip:sched/core] sched/cputime: Increment kcpustat directly on  irqtime account tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [PATCH RESEND 10/36] x86: Convert obsolete cputime type to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 05:20 +0100
      [tip:sched/core] x86: Convert obsolete cputime type to nsecs tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
    [PATCH RESEND 33/36] powerpc: Remove unused cputime definitions Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-31 05:30 +0100
      [tip:sched/core] powerpc, sched/cputime: Remove unused cputime  definitions tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:10 +0100
    [tip:sched/core] jiffies: Reuse TICK_NSEC instead of NSEC_PER_JIFFY tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-01 11:00 +0100
  Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-02-06 14:50 +0100
    Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Ingo Molnar <mingo@kernel.org> - 2017-02-07 09:10 +0100
      Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Frederic Weisbecker <fweisbec@gmail.com> - 2017-02-07 15:10 +0100
        Re: [GIT PULL] cputime: Convert core use of cputime_t to nsecs Ingo Molnar <mingo@kernel.org> - 2017-02-07 20:00 +0100

csiph-web