* [PATCH 03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp()
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
@ 2022-01-23 18:38 ` Yury Norov
2022-02-04 18:29 ` Rafael J. Wysocki
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Yury Norov
1 sibling, 1 reply; 5+ messages in thread
From: Yury Norov @ 2022-01-23 18:38 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui,
Sebastian Andrzej Siewior, Christophe JAILLET, Rikard Falkeborn,
linux-pm
Don't call bitmap_weight() if the following code can get by
without it.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/thermal/intel/intel_powerclamp.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 14256421d98c..c841ab37e7c6 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -556,12 +556,9 @@ static void end_power_clamp(void)
* stop faster.
*/
clamping = false;
- if (bitmap_weight(cpu_clamping_mask, num_possible_cpus())) {
- for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
- pr_debug("clamping worker for cpu %d alive, destroy\n",
- i);
- stop_power_clamp_worker(i);
- }
+ for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
+ pr_debug("clamping worker for cpu %d alive, destroy\n", i);
+ stop_power_clamp_worker(i);
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
2022-01-23 18:38 ` [PATCH 03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp() Yury Norov
@ 2022-01-23 18:38 ` Yury Norov
2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
1 sibling, 2 replies; 5+ messages in thread
From: Yury Norov @ 2022-01-23 18:38 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Andy Gross, Bjorn Andersson, Rafael J. Wysocki, Viresh Kumar,
Sudeep Holla, Cristian Marussi, linux-arm-msm, linux-pm,
linux-arm-kernel
drivers/cpufreq calls cpumask_weight() to check if any bit of a given
cpumask is set. We can do it more efficiently with cpumask_empty() because
cpumask_empty() stops traversing the cpumask as soon as it finds first set
bit, while cpumask_weight() counts all bits unconditionally.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
drivers/cpufreq/scmi-cpufreq.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 05f3d7876e44..95a0c57ab5bb 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -482,7 +482,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
}
qcom_get_related_cpus(index, policy->cpus);
- if (!cpumask_weight(policy->cpus)) {
+ if (cpumask_empty(policy->cpus)) {
dev_err(dev, "Domain-%d failed to get related CPUs\n", index);
ret = -ENOENT;
goto error;
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 1e0cd4d165f0..919fa6e3f462 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -154,7 +154,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
* table and opp-shared.
*/
ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->opp_shared_cpus);
- if (ret || !cpumask_weight(priv->opp_shared_cpus)) {
+ if (ret || cpumask_empty(priv->opp_shared_cpus)) {
/*
* Either opp-table is not set or no opp-shared was found.
* Use the CPU mask from SCMI to designate CPUs sharing an OPP
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Yury Norov
@ 2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
1 sibling, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2022-01-24 10:41 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Sudeep Holla,
Peter Zijlstra, David Laight, Joe Perches, Dennis Zhou,
Emil Renner Berthing, Nicholas Piggin, Matti Vaittinen,
Alexey Klimov, linux-kernel, Andy Gross, Bjorn Andersson,
Rafael J. Wysocki, Viresh Kumar, Cristian Marussi, linux-arm-msm,
linux-pm, linux-arm-kernel
On Sun, Jan 23, 2022 at 10:38:47AM -0800, Yury Norov wrote:
> drivers/cpufreq calls cpumask_weight() to check if any bit of a given
> cpumask is set. We can do it more efficiently with cpumask_empty() because
> cpumask_empty() stops traversing the cpumask as soon as it finds first set
> bit, while cpumask_weight() counts all bits unconditionally.
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> (for SCMI cpufreq driver)
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp()
2022-01-23 18:38 ` [PATCH 03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp() Yury Norov
@ 2022-02-04 18:29 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-02-04 18:29 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov,
Linux Kernel Mailing List, Rafael J. Wysocki, Daniel Lezcano,
Amit Kucheria, Zhang Rui, Sebastian Andrzej Siewior,
Christophe JAILLET, Rikard Falkeborn, Linux PM
On Sun, Jan 23, 2022 at 7:39 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> Don't call bitmap_weight() if the following code can get by
> without it.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
> drivers/thermal/intel/intel_powerclamp.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 14256421d98c..c841ab37e7c6 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -556,12 +556,9 @@ static void end_power_clamp(void)
> * stop faster.
> */
> clamping = false;
> - if (bitmap_weight(cpu_clamping_mask, num_possible_cpus())) {
> - for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
> - pr_debug("clamping worker for cpu %d alive, destroy\n",
> - i);
> - stop_power_clamp_worker(i);
> - }
> + for_each_set_bit(i, cpu_clamping_mask, num_possible_cpus()) {
> + pr_debug("clamping worker for cpu %d alive, destroy\n", i);
> + stop_power_clamp_worker(i);
> }
> }
>
> --
Applied as 5.18 material, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Yury Norov
2022-01-24 10:41 ` Sudeep Holla
@ 2022-02-09 6:15 ` Viresh Kumar
1 sibling, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2022-02-09 6:15 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Andy Gross, Bjorn Andersson, Rafael J. Wysocki, Sudeep Holla,
Cristian Marussi, linux-arm-msm, linux-pm, linux-arm-kernel
On 23-01-22, 10:38, Yury Norov wrote:
> drivers/cpufreq calls cpumask_weight() to check if any bit of a given
> cpumask is set. We can do it more efficiently with cpumask_empty() because
> cpumask_empty() stops traversing the cpumask as soon as it finds first set
> bit, while cpumask_weight() counts all bits unconditionally.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
> drivers/cpufreq/scmi-cpufreq.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-09 6:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
2022-01-23 18:38 ` [PATCH 03/54] thermal/intel: don't use bitmap_weight() in end_power_clamp() Yury Norov
2022-02-04 18:29 ` Rafael J. Wysocki
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Yury Norov
2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
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).