mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	preeti.lkml@gmail.com, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 2/9] cpufreq: conservative: remove 'enable' field
Date: Tue, 08 Sep 2015 02:17:31 +0200	[thread overview]
Message-ID: <2910194.KRcaApdNFO@vostro.rjw.lan> (raw)
In-Reply-To: <91abed4ff8fe68f26fe0bdc840982bb972dba6dc.1437999691.git.viresh.kumar@linaro.org>

On Monday, July 27, 2015 05:58:07 PM Viresh Kumar wrote:
> Conservative governor has its own 'enable' field to check if
> conservative governor is used for a CPU or not
> 
> This can be checked by policy->governor with 'cpufreq_gov_conservative'
> and so this field can be dropped.
> 
> Because its not guaranteed that dbs_info->cdbs.shared will a valid
> pointer for all CPUs (will be NULL for CPUs that don't use
> ondemand/conservative governors), we can't use it anymore. Lets get
> policy with cpufreq_cpu_get() instead.

But previously, if the enable bit was set, we actually new that the
pointer was valid, right?

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/cpufreq_conservative.c | 34 +++++++++++++++++++++-------------
>  drivers/cpufreq/cpufreq_governor.c     | 12 +-----------
>  drivers/cpufreq/cpufreq_governor.h     |  1 -
>  3 files changed, 22 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
> index 84a1506950a7..18bfbc313e48 100644
> --- a/drivers/cpufreq/cpufreq_conservative.c
> +++ b/drivers/cpufreq/cpufreq_conservative.c
> @@ -23,6 +23,19 @@
>  
>  static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info);
>  
> +static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy,
> +				   unsigned int event);
> +
> +#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
> +static
> +#endif
> +struct cpufreq_governor cpufreq_gov_conservative = {
> +	.name			= "conservative",
> +	.governor		= cs_cpufreq_governor_dbs,
> +	.max_transition_latency	= TRANSITION_LATENCY_LIMIT,
> +	.owner			= THIS_MODULE,
> +};
> +
>  static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners,
>  					   struct cpufreq_policy *policy)
>  {
> @@ -119,12 +132,14 @@ static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
>  	struct cpufreq_freqs *freq = data;
>  	struct cs_cpu_dbs_info_s *dbs_info =
>  					&per_cpu(cs_cpu_dbs_info, freq->cpu);
> -	struct cpufreq_policy *policy;
> +	struct cpufreq_policy *policy = cpufreq_cpu_get(freq->cpu);
>  
> -	if (!dbs_info->enable)
> +	if (!policy)
>  		return 0;
>  
> -	policy = dbs_info->cdbs.shared->policy;

So here we could get to the policy directly.  After the change we have to:

- acquire cpufreq_rwsem
- acquire cpufreq_driver_lock
- go the kobject_get on policy->kobj

and then finally drop the reference to the kobject when we're done.

So may I ask where exactly is the improvement?

> +	/* policy isn't governed by conservative governor */
> +	if (policy->governor != &cpufreq_gov_conservative)
> +		goto policy_put;
>  
>  	/*
>  	 * we only care if our internally tracked freq moves outside the 'valid'

Thanks,
Rafael


  reply	other threads:[~2015-09-07 23:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1437999691.git.viresh.kumar@linaro.org>
2015-07-27 12:28 ` [PATCH V2 1/9] cpufreq: Use __func__ to print function's name Viresh Kumar
2015-09-07 23:42   ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 2/9] cpufreq: conservative: remove 'enable' field Viresh Kumar
2015-09-08  0:17   ` Rafael J. Wysocki [this message]
2015-09-08  1:33     ` Viresh Kumar
2015-09-08  1:40     ` [PATCH V3 " Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 3/9] cpufreq: ondemand: only queue canceled works from update_sampling_rate() Viresh Kumar
2015-09-08  1:11   ` Rafael J. Wysocki
2015-09-08  1:58     ` Viresh Kumar
2015-09-09  1:06       ` Rafael J. Wysocki
2015-09-09  2:30         ` Viresh Kumar
2015-09-09 20:10           ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 4/9] cpufreq: governor: Drop __gov_queue_work() Viresh Kumar
2015-09-08  1:15   ` Rafael J. Wysocki
2015-09-08  2:00     ` Viresh Kumar
2015-09-09  1:04       ` Rafael J. Wysocki
2015-07-27 12:28 ` [PATCH V2 5/9] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 6/9] cpufreq: ondemand: queue work for policy->cpus together Viresh Kumar
2015-09-08  1:33   ` Rafael J. Wysocki
2015-09-08  2:11     ` Viresh Kumar
2015-09-08  2:13       ` Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 7/9] cpufreq: ondemand: update sampling rate immidiately Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 8/9] cpufreq: governor: Quit work-handlers early if governor is stopped Viresh Kumar
2015-07-27 12:28 ` [PATCH V2 9/9] cpufreq: Get rid of ->governor_enabled and its lock Viresh Kumar

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=2910194.KRcaApdNFO@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=preeti.lkml@gmail.com \
    --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

Powered by JetHome