From: Viresh Kumar <viresh.kumar@linaro.org> To: Kevin Hilman <khilman@linaro.org> Cc: Frederic Weisbecker <fweisbec@gmail.com>, Russell King <rmk+kernel@arm.linux.org.uk>, Thomas Gleixner <tglx@linutronix.de>, Peter Zijlstra <peterz@infradead.org>, Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@kernel.org>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, "Rafael J. Wysocki" <rjw@sisk.pl> Subject: Re: [PATCH 1/2] cpustat: use accessor functions for get/set/add Date: Fri, 22 Feb 2013 11:51:43 +0530 [thread overview] Message-ID: <CAOh2x=kFL5_H=LqLf14yxYQEs7zSTT8Ue8mjUEVN4_a0c53Rdg@mail.gmail.com> (raw) In-Reply-To: <1361512604-2720-2-git-send-email-khilman@linaro.org> On Fri, Feb 22, 2013 at 11:26 AM, Kevin Hilman <khilman@linaro.org> wrote: > Add some accessor functions in order to facilitate the conversion to > atomic reads/writes of cpustat values. > > Signed-off-by: Kevin Hilman <khilman@linaro.org> > --- > drivers/cpufreq/cpufreq_governor.c | 18 ++++++++--------- > drivers/cpufreq/cpufreq_ondemand.c | 2 +- > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c > index 6c5f1d3..ec6c315 100644 > --- a/drivers/cpufreq/cpufreq_governor.c > +++ b/drivers/cpufreq/cpufreq_governor.c > @@ -36,12 +36,12 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) > > cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); > > - busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; > + busy_time = kcpustat_cpu_get(cpu, CPUTIME_USER); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SYSTEM); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_IRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SOFTIRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_STEAL); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_NICE); > > idle_time = cur_wall_time - busy_time; > if (wall) > @@ -103,7 +103,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > u64 cur_nice; > unsigned long cur_nice_jiffies; > > - cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE] - > + cur_nice = kcpustat_cpu_get(j, CPUTIME_NICE) - > cdbs->prev_cpu_nice; > /* > * Assumption: nice time between sampling periods will > @@ -113,7 +113,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > cputime64_to_jiffies64(cur_nice); > > cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > idle_time += jiffies_to_usecs(cur_nice_jiffies); > } > > @@ -216,7 +216,7 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, > &j_cdbs->prev_cpu_wall); > if (ignore_nice) > j_cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > } > > /* > diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c > index 7731f7c..ac5d49f 100644 > --- a/drivers/cpufreq/cpufreq_ondemand.c > +++ b/drivers/cpufreq/cpufreq_ondemand.c > @@ -403,7 +403,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, > &dbs_info->cdbs.prev_cpu_wall); > if (od_tuners.ignore_nice) > dbs_info->cdbs.prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > > } > return count; For cpufreq: Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Though i believe you also need this: diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 64ef737..38e3ad7 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -242,7 +242,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, &dbs_info->cdbs.prev_cpu_wall); if (cs_tuners.ignore_nice) dbs_info->cdbs.prev_cpu_nice = - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + kcpustat_cpu_get(j, CPUTIME_NICE); } return count; } BTW, i don't see kcpustat_cpu() used in kernel/sched/core.c | 12 +++++------- kernel/sched/cputime.c | 29 +++++++++++++-------------- I searched tip/master as well as lnext/master.
WARNING: multiple messages have this Message-ID (diff)
From: viresh.kumar@linaro.org (Viresh Kumar) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] cpustat: use accessor functions for get/set/add Date: Fri, 22 Feb 2013 11:51:43 +0530 [thread overview] Message-ID: <CAOh2x=kFL5_H=LqLf14yxYQEs7zSTT8Ue8mjUEVN4_a0c53Rdg@mail.gmail.com> (raw) In-Reply-To: <1361512604-2720-2-git-send-email-khilman@linaro.org> On Fri, Feb 22, 2013 at 11:26 AM, Kevin Hilman <khilman@linaro.org> wrote: > Add some accessor functions in order to facilitate the conversion to > atomic reads/writes of cpustat values. > > Signed-off-by: Kevin Hilman <khilman@linaro.org> > --- > drivers/cpufreq/cpufreq_governor.c | 18 ++++++++--------- > drivers/cpufreq/cpufreq_ondemand.c | 2 +- > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c > index 6c5f1d3..ec6c315 100644 > --- a/drivers/cpufreq/cpufreq_governor.c > +++ b/drivers/cpufreq/cpufreq_governor.c > @@ -36,12 +36,12 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) > > cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); > > - busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; > + busy_time = kcpustat_cpu_get(cpu, CPUTIME_USER); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SYSTEM); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_IRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SOFTIRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_STEAL); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_NICE); > > idle_time = cur_wall_time - busy_time; > if (wall) > @@ -103,7 +103,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > u64 cur_nice; > unsigned long cur_nice_jiffies; > > - cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE] - > + cur_nice = kcpustat_cpu_get(j, CPUTIME_NICE) - > cdbs->prev_cpu_nice; > /* > * Assumption: nice time between sampling periods will > @@ -113,7 +113,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > cputime64_to_jiffies64(cur_nice); > > cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > idle_time += jiffies_to_usecs(cur_nice_jiffies); > } > > @@ -216,7 +216,7 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, > &j_cdbs->prev_cpu_wall); > if (ignore_nice) > j_cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > } > > /* > diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c > index 7731f7c..ac5d49f 100644 > --- a/drivers/cpufreq/cpufreq_ondemand.c > +++ b/drivers/cpufreq/cpufreq_ondemand.c > @@ -403,7 +403,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, > &dbs_info->cdbs.prev_cpu_wall); > if (od_tuners.ignore_nice) > dbs_info->cdbs.prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > > } > return count; For cpufreq: Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Though i believe you also need this: diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 64ef737..38e3ad7 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -242,7 +242,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, &dbs_info->cdbs.prev_cpu_wall); if (cs_tuners.ignore_nice) dbs_info->cdbs.prev_cpu_nice = - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + kcpustat_cpu_get(j, CPUTIME_NICE); } return count; } BTW, i don't see kcpustat_cpu() used in kernel/sched/core.c | 12 +++++------- kernel/sched/cputime.c | 29 +++++++++++++-------------- I searched tip/master as well as lnext/master.
next prev parent reply other threads:[~2013-02-22 6:21 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-22 5:56 [PATCH 0/2] cpustat: use atomic operations to read/update stats Kevin Hilman 2013-02-22 5:56 ` Kevin Hilman 2013-02-22 5:56 ` [PATCH 1/2] cpustat: use accessor functions for get/set/add Kevin Hilman 2013-02-22 5:56 ` Kevin Hilman 2013-02-22 6:21 ` Viresh Kumar [this message] 2013-02-22 6:21 ` Viresh Kumar 2013-02-22 7:17 ` Amit Kucheria 2013-02-22 7:17 ` Amit Kucheria 2013-02-22 7:50 ` Viresh Kumar 2013-02-22 7:50 ` Viresh Kumar 2013-02-22 12:34 ` Frederic Weisbecker 2013-02-22 12:34 ` Frederic Weisbecker 2013-02-22 15:14 ` Kevin Hilman 2013-02-22 15:14 ` Kevin Hilman 2013-02-22 13:38 ` Frederic Weisbecker 2013-02-22 13:38 ` Frederic Weisbecker 2013-02-22 13:58 ` Peter Zijlstra 2013-02-22 13:58 ` Peter Zijlstra 2013-02-22 14:03 ` Frederic Weisbecker 2013-02-22 14:03 ` Frederic Weisbecker 2013-02-22 5:56 ` [PATCH 2/2] cpustat: convert to atomic operations Kevin Hilman 2013-02-22 5:56 ` Kevin Hilman 2013-02-22 8:46 ` [PATCH 0/2] cpustat: use atomic operations to read/update stats Peter Zijlstra 2013-02-22 8:46 ` Peter Zijlstra 2013-02-22 12:50 ` Frederic Weisbecker 2013-02-22 12:50 ` Frederic Weisbecker 2013-02-22 13:48 ` Peter Zijlstra 2013-02-22 13:48 ` Peter Zijlstra 2013-02-22 13:54 ` Ingo Molnar 2013-02-22 13:54 ` Ingo Molnar 2013-02-22 14:04 ` Peter Zijlstra 2013-02-22 14:04 ` Peter Zijlstra 2013-02-22 14:16 ` Ingo Molnar 2013-02-22 14:16 ` Ingo Molnar 2013-02-22 14:25 ` Peter Zijlstra 2013-02-22 14:25 ` Peter Zijlstra 2013-02-22 14:05 ` Peter Zijlstra 2013-02-22 14:05 ` Peter Zijlstra 2013-02-22 14:15 ` Frederic Weisbecker 2013-02-22 14:15 ` Frederic Weisbecker 2013-02-22 14:09 ` Peter Zijlstra 2013-02-22 14:09 ` Peter Zijlstra 2013-02-22 14:18 ` Ingo Molnar 2013-02-22 14:18 ` Ingo Molnar 2013-02-22 14:21 ` Eric Dumazet 2013-02-22 14:21 ` Eric Dumazet 2013-02-22 14:23 ` Frederic Weisbecker 2013-02-22 14:23 ` Frederic Weisbecker 2013-02-22 19:01 ` Kevin Hilman 2013-02-22 19:01 ` Kevin Hilman
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='CAOh2x=kFL5_H=LqLf14yxYQEs7zSTT8Ue8mjUEVN4_a0c53Rdg@mail.gmail.com' \ --to=viresh.kumar@linaro.org \ --cc=fweisbec@gmail.com \ --cc=khilman@linaro.org \ --cc=linaro-kernel@lists.linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@kernel.org \ --cc=peterz@infradead.org \ --cc=rjw@sisk.pl \ --cc=rmk+kernel@arm.linux.org.uk \ --cc=rostedt@goodmis.org \ --cc=tglx@linutronix.de \ /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: linkBe 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.