From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ivan Delalande <colona@arista.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
Rabin Vincent <rabin.vincent@axis.com>,
Edward Chron <echron@arista.com>,
stable@vger.kernel.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Rik van Riel <riel@redhat.com>,
Stanislaw Gruszka <sgruszka@redhat.com>,
Wanpeng Li <wanpeng.li@hotmail.com>
Subject: Re: [PATCH 4.9 2/4] sched/cputime: Convert kcpustat to nsecs
Date: Fri, 12 Oct 2018 16:42:19 +0200 [thread overview]
Message-ID: <20181012144219.GA14454@kroah.com> (raw)
In-Reply-To: <20180907014218.18683-3-colona@arista.com>
On Thu, Sep 06, 2018 at 06:42:16PM -0700, Ivan Delalande wrote:
> From: Frederic Weisbecker <fweisbec@gmail.com>
>
> 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 <fweisbec@gmail.com>
> 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: Stanislaw Gruszka <sgruszka@redhat.com>
> Cc: Wanpeng Li <wanpeng.li@hotmail.com>
> Link: http://lkml.kernel.org/r/1485832191-26889-4-git-send-email-fweisbec@gmail.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> [colona: minor conflict as 527b0a76f41d ("sched/cpuacct: Avoid %lld seq_printf
> warning") is missing from v4.9]
> Signed-off-by: Ivan Delalande <colona@arista.com>
> ---
> 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 <linux/cpufreq.h>
> #include <linux/module.h>
> #include <linux/slab.h>
> -#include <linux/cputime.h>
>
> 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
next prev parent reply other threads:[~2018-10-12 22:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 1:42 [PATCH 4.9 0/4] Fix softirq time accounting issues on 4.9 Ivan Delalande
2018-09-07 1:42 ` [PATCH 4.9 1/4] time: Introduce jiffies64_to_nsecs() Ivan Delalande
2018-09-07 1:42 ` [PATCH 4.9 2/4] sched/cputime: Convert kcpustat to nsecs Ivan Delalande
2018-10-12 14:42 ` Greg Kroah-Hartman [this message]
2018-09-07 1:42 ` [PATCH 4.9 3/4] sched/cputime: Increment kcpustat directly on irqtime account Ivan Delalande
2018-09-07 1:42 ` [PATCH 4.9 4/4] sched/cputime: Fix ksoftirqd cputime accounting regression Ivan Delalande
2018-09-13 23:13 ` [PATCH 4.9 0/4] Fix softirq time accounting issues on 4.9 Ivan Delalande
2018-09-14 6:57 ` Greg Kroah-Hartman
2018-10-11 14:11 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181012144219.GA14454@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=benh@kernel.crashing.org \
--cc=colona@arista.com \
--cc=echron@arista.com \
--cc=fenghua.yu@intel.com \
--cc=fweisbec@gmail.com \
--cc=heiko.carstens@de.ibm.com \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rabin.vincent@axis.com \
--cc=riel@redhat.com \
--cc=schwidefsky@de.ibm.com \
--cc=sgruszka@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.