Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244171 > unrolled thread

[PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask

Started byViresh Kumar <viresh.kumar@linaro.org>
First post2015-10-11 19:30 +0200
Last post2015-10-13 21:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask Viresh Kumar <viresh.kumar@linaro.org> - 2015-10-11 19:30 +0200
    Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to  copy a mask Saravana Kannan <skannan@codeaurora.org> - 2015-10-12 21:20 +0200
      Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to  copy a mask Viresh Kumar <viresh.kumar@linaro.org> - 2015-10-13 05:30 +0200
        Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to  copy a mask Saravana Kannan <skannan@codeaurora.org> - 2015-10-13 21:30 +0200

#1244171 — [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask

FromViresh Kumar <viresh.kumar@linaro.org>
Date2015-10-11 19:30 +0200
Subject[PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask
Message-ID<qisBA-6Ef-25@gated-at.bofh.it>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 25c4c15103a0..b32521432db4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1221,7 +1221,7 @@ static int cpufreq_online(unsigned int cpu)
 
 	if (new_policy) {
 		/* related_cpus should at least include policy->cpus. */
-		cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
+		cpumask_copy(policy->related_cpus, policy->cpus);
 		/* Remember CPUs present at the policy creation time. */
 		cpumask_and(policy->real_cpus, policy->cpus, cpu_present_mask);
 	}
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1245051 — Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask

FromSaravana Kannan <skannan@codeaurora.org>
Date2015-10-12 21:20 +0200
SubjectRe: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask
Message-ID<qiQNB-8hD-43@gated-at.bofh.it>
In reply to#1244171
On 10/11/2015 10:21 AM, Viresh Kumar wrote:
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

The commit text should explain the why you are doing this.

> ---
>   drivers/cpufreq/cpufreq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 25c4c15103a0..b32521432db4 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1221,7 +1221,7 @@ static int cpufreq_online(unsigned int cpu)
>
>   	if (new_policy) {
>   		/* related_cpus should at least include policy->cpus. */
> -		cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
> +		cpumask_copy(policy->related_cpus, policy->cpus);

Again, why? It actually seems wrong. A 4 core cluster could come up with 
just 2 cores when the policy is added. But the related CPUs would be 4 CPUs.

>   		/* Remember CPUs present at the policy creation time. */
>   		cpumask_and(policy->real_cpus, policy->cpus, cpu_present_mask);
>   	}
>

-Saravana

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1245311 — Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask

FromViresh Kumar <viresh.kumar@linaro.org>
Date2015-10-13 05:30 +0200
SubjectRe: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask
Message-ID<qiYrL-2vS-1@gated-at.bofh.it>
In reply to#1245051
On 12-10-15, 12:12, Saravana Kannan wrote:
> >  	if (new_policy) {
> >  		/* related_cpus should at least include policy->cpus. */
> >-		cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
> >+		cpumask_copy(policy->related_cpus, policy->cpus);
> 
> Again, why? It actually seems wrong. A 4 core cluster could come up
> with just 2 cores when the policy is added. But the related CPUs
> would be 4 CPUs.

Firstly, the patch hasn't changed anything at all. related_cpus was
empty until this point, and orring or setting it with ->cpus will
result in the same output.

Secondly, this is what we always wanted. related_cpus should contain
the mask of all possible CPUs for that cluster.

-- 
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1246069 — Re: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask

FromSaravana Kannan <skannan@codeaurora.org>
Date2015-10-13 21:30 +0200
SubjectRe: [PATCH 1/5] cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask
Message-ID<qjdqO-7D7-21@gated-at.bofh.it>
In reply to#1245311
On 10/12/2015 08:23 PM, Viresh Kumar wrote:
> On 12-10-15, 12:12, Saravana Kannan wrote:
>>>   	if (new_policy) {
>>>   		/* related_cpus should at least include policy->cpus. */
>>> -		cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
>>> +		cpumask_copy(policy->related_cpus, policy->cpus);
>>
>> Again, why? It actually seems wrong. A 4 core cluster could come up
>> with just 2 cores when the policy is added. But the related CPUs
>> would be 4 CPUs.
>
> Firstly, the patch hasn't changed anything at all. related_cpus was
> empty until this point, and orring or setting it with ->cpus will
> result in the same output.

I was under the impression that the CPUfreq drivers were expected to 
fill in related_cpus and the or-ing was a safety net. If that's not the 
case, then this change is fine.

> Secondly, this is what we always wanted. related_cpus should contain
> the mask of all possible CPUs for that cluster.

I think the confusion was that I thought the drivers are supposed to do 
this. If this doesn't mess up other CPUfreq drivers that I'm not 
familiar with, then I don't have concerns.

Can you still explain the why in the commit text though? If it's just 
that related_cpus is always empty and copying is more efficient than 
or-ing, then mention that?

Thanks,
Saravana

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web