From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:60562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728720AbeJLWPI (ORCPT ); Fri, 12 Oct 2018 18:15:08 -0400 Date: Fri, 12 Oct 2018 16:42:19 +0200 From: Greg Kroah-Hartman To: Ivan Delalande Cc: Frederic Weisbecker , Ingo Molnar , Rabin Vincent , Edward Chron , stable@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Martin Schwidefsky , Tony Luck , Fenghua Yu , Peter Zijlstra , Rik van Riel , Stanislaw Gruszka , Wanpeng Li Subject: Re: [PATCH 4.9 2/4] sched/cputime: Convert kcpustat to nsecs Message-ID: <20181012144219.GA14454@kroah.com> References: <20180907014218.18683-1-colona@arista.com> <20180907014218.18683-3-colona@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180907014218.18683-3-colona@arista.com> Sender: stable-owner@vger.kernel.org List-ID: On Thu, Sep 06, 2018 at 06:42:16PM -0700, Ivan Delalande wrote: > From: Frederic Weisbecker > > commit 7fb1327ee9b92fca27662f9b9d60c7c3376d6c69 upstream. > > Kernel CPU stats are stored in cputime_t which is an architecture > defined type, and hence a bit opaque and requiring accessors and mutators > for any operation. > > Converting them to nsecs simplifies the code and is one step toward > the removal of cputime_t in the core code. > > Signed-off-by: Frederic Weisbecker > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: Heiko Carstens > Cc: Martin Schwidefsky > Cc: Tony Luck > Cc: Fenghua Yu > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: Stanislaw Gruszka > Cc: Wanpeng Li > Link: http://lkml.kernel.org/r/1485832191-26889-4-git-send-email-fweisbec@gmail.com > Signed-off-by: Ingo Molnar > [colona: minor conflict as 527b0a76f41d ("sched/cpuacct: Avoid %lld seq_printf > warning") is missing from v4.9] > Signed-off-by: Ivan Delalande > --- > arch/s390/appldata/appldata_os.c | 16 +++---- > drivers/cpufreq/cpufreq.c | 6 +-- > drivers/cpufreq/cpufreq_governor.c | 2 +- > drivers/cpufreq/cpufreq_stats.c | 1 - > drivers/macintosh/rack-meter.c | 2 +- > fs/proc/stat.c | 68 +++++++++++++++--------------- > fs/proc/uptime.c | 7 +-- > kernel/sched/cpuacct.c | 2 +- > kernel/sched/cputime.c | 22 +++++----- > 9 files changed, 61 insertions(+), 65 deletions(-) > > diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c > index 69b23b25ac34..08b9e942a262 100644 > --- a/arch/s390/appldata/appldata_os.c > +++ b/arch/s390/appldata/appldata_os.c > @@ -113,21 +113,21 @@ static void appldata_get_os_data(void *data) > j = 0; > for_each_online_cpu(i) { > os_data->os_cpu[j].per_cpu_user = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); > os_data->os_cpu[j].per_cpu_nice = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); > os_data->os_cpu[j].per_cpu_system = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); > os_data->os_cpu[j].per_cpu_idle = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); > os_data->os_cpu[j].per_cpu_irq = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); > os_data->os_cpu[j].per_cpu_softirq = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); > os_data->os_cpu[j].per_cpu_iowait = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); > os_data->os_cpu[j].per_cpu_steal = > - cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); > + nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); > os_data->os_cpu[j].cpu_id = i; > j++; > } > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index af5eff6835a8..d6d91e8afa9e 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -132,7 +132,7 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) > u64 cur_wall_time; > u64 busy_time; > > - cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); > + cur_wall_time = jiffies64_to_nsecs(get_jiffies_64()); > > busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; > busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; > @@ -143,9 +143,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) > > idle_time = cur_wall_time - busy_time; > if (wall) > - *wall = cputime_to_usecs(cur_wall_time); > + *wall = div_u64(cur_wall_time, NSEC_PER_USEC); > > - return cputime_to_usecs(idle_time); > + return div_u64(idle_time, NSEC_PER_USEC); > } > > u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy) > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c > index 642dd0f183a8..38d1a8216084 100644 > --- a/drivers/cpufreq/cpufreq_governor.c > +++ b/drivers/cpufreq/cpufreq_governor.c > @@ -152,7 +152,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy) > if (ignore_nice) { > u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > > - idle_time += cputime_to_usecs(cur_nice - j_cdbs->prev_cpu_nice); > + idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC); > j_cdbs->prev_cpu_nice = cur_nice; > } > > diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c > index 06d3abdffd3a..b084708fd113 100644 > --- a/drivers/cpufreq/cpufreq_stats.c > +++ b/drivers/cpufreq/cpufreq_stats.c > @@ -13,7 +13,6 @@ > #include > #include > #include > -#include > > static DEFINE_SPINLOCK(cpufreq_stats_lock); > > diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c > index 25852e399ab2..13b16f34256c 100644 > --- a/drivers/macintosh/rack-meter.c > +++ b/drivers/macintosh/rack-meter.c > @@ -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 retval; > + return nsecs_to_cputime64(retval); Turns out this patch breaks the build here on powerpc :( And I can't easily figure out how to fix it up. So I'm going to drop this series from the 4.9 tree right now. Can you fix this up and resend? thanks, greg k-h