From: Fabio Baltieri <fabio.baltieri@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@sisk.pl, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linaro-dev@lists.linaro.org, patches@linaro.org,
pdsw-power-team@arm.com, arvind.chauhan@arm.com
Subject: Re: [PATCH 2/2] cpufreq: governors: remove redundant code
Date: Fri, 23 Nov 2012 14:00:22 +0100 [thread overview]
Message-ID: <20121123130022.GB7378@balto.lan> (raw)
In-Reply-To: <98478a02ae69afc01b3c7860e42a4d763b2045e8.1350677395.git.viresh.kumar@linaro.org>
Hello Viresh,
On Sat, Oct 20, 2012 at 01:42:06AM +0530, Viresh Kumar wrote:
> +static inline int delay_for_sampling_rate(unsigned int sampling_rate)
> +{
> + int delay = usecs_to_jiffies(sampling_rate);
> +
> + /* We want all CPUs to do sampling nearly on same jiffy */
> + if (num_online_cpus() > 1)
> + delay -= jiffies % delay;
> +
> + return delay;
> +}
[...]
> +static void od_dbs_timer(struct work_struct *work)
> +{
> + struct od_cpu_dbs_info_s *dbs_info =
> + container_of(work, struct od_cpu_dbs_info_s, cdbs.work.work);
> + unsigned int cpu = dbs_info->cdbs.cpu;
> + int delay, sample_type = dbs_info->sample_type;
> +
> + mutex_lock(&dbs_info->cdbs.timer_mutex);
>
> -/* cpufreq_ondemand Governor Tunables */
> -#define show_one(file_name, object) \
> -static ssize_t show_##file_name \
> -(struct kobject *kobj, struct attribute *attr, char *buf) \
> -{ \
> - return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
> + /* Common NORMAL_SAMPLE setup */
> + dbs_info->sample_type = OD_NORMAL_SAMPLE;
> + if (sample_type == OD_SUB_SAMPLE) {
> + delay = dbs_info->freq_lo_jiffies;
> + __cpufreq_driver_target(dbs_info->cdbs.cur_policy,
> + dbs_info->freq_lo, CPUFREQ_RELATION_H);
> + } else {
> + dbs_check_cpu(&od_dbs_data, cpu);
> + if (dbs_info->freq_lo) {
> + /* Setup timer for SUB_SAMPLE */
> + dbs_info->sample_type = OD_SUB_SAMPLE;
> + delay = dbs_info->freq_hi_jiffies;
> + } else {
> + delay = delay_for_sampling_rate(dbs_info->rate_mult);
^^^^^^^^^^^^^^^^^^^
I think this one should be:
delay = delay_for_sampling_rate(od_tuners.sampling_rate * dbs_info->rate_mult);
as currently the timer is firing every jiffy. This was the old code:
> -static void do_dbs_timer(struct work_struct *work)
[...]
> - delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate
> - * dbs_info->rate_mult);
> -
> - if (num_online_cpus() > 1)
> - delay -= jiffies % delay;
I'm sending a patch for this one.
Fabio
--
Fabio Baltieri
next prev parent reply other threads:[~2012-11-23 13:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 20:12 [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Viresh Kumar
2012-10-19 20:12 ` [PATCH 2/2] cpufreq: governors: remove redundant code Viresh Kumar
2012-10-22 8:46 ` Viresh Kumar
2012-10-24 6:07 ` Viresh Kumar
2012-10-24 19:43 ` Rafael J. Wysocki
2012-10-24 21:12 ` Rafael J. Wysocki
2012-10-25 3:29 ` Viresh Kumar
2012-10-26 0:13 ` Rafael J. Wysocki
2012-10-26 3:28 ` Viresh Kumar
2012-11-23 13:00 ` Fabio Baltieri [this message]
2012-10-19 22:11 ` [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Rafael J. Wysocki
[not found] ` <CAKohponGwhC_zmk1Whq56vmZMvjcxXKiSpdvMk4ZU8z0Wa2TBw@mail.gmail.com>
2012-10-20 7:09 ` Viresh Kumar
2012-10-24 22:02 ` Rafael J. Wysocki
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=20121123130022.GB7378@balto.lan \
--to=fabio.baltieri@linaro.org \
--cc=arvind.chauhan@arm.com \
--cc=cpufreq@vger.kernel.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patches@linaro.org \
--cc=pdsw-power-team@arm.com \
--cc=rjw@sisk.pl \
--cc=viresh.kumar@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).