Messages in this thread Patch in this message | | | From | Yury Norov <> | Subject | [PATCH 19/22] sched/core: replace cpumask_weight() with cpumask_weight_eq() where appropriate | Date | Tue, 10 May 2022 08:47:47 -0700 |
| |
cpumask_weight_eq() is better than cpumask_weight() because it may return earlier depending on condition.
CC: Ben Segall <bsegall@google.com> CC: Daniel Bristot de Oliveira <bristot@redhat.com> CC: Dietmar Eggemann <dietmar.eggemann@arm.com> CC: Ingo Molnar <mingo@redhat.com> CC: Juri Lelli <juri.lelli@redhat.com> CC: Mel Gorman <mgorman@suse.de> CC: Peter Zijlstra <peterz@infradead.org> CC: Steven Rostedt <rostedt@goodmis.org> CC: Valentin Schneider <vschneid@redhat.com> CC: Vincent Guittot <vincent.guittot@linaro.org> CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov <yury.norov@gmail.com> --- kernel/sched/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 07b8f35cbe36..6bbd5e880984 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9234,7 +9234,7 @@ int sched_cpu_activate(unsigned int cpu) /* * When going up, increment the number of cores with SMT present. */ - if (cpumask_weight(cpu_smt_mask(cpu)) == 2) + if (cpumask_weight_eq(cpu_smt_mask(cpu), 2)) static_branch_inc_cpuslocked(&sched_smt_present); #endif set_cpu_active(cpu, true); @@ -9310,7 +9310,7 @@ int sched_cpu_deactivate(unsigned int cpu) /* * When going down, decrement the number of cores with SMT present. */ - if (cpumask_weight(cpu_smt_mask(cpu)) == 2) + if (cpumask_weight_eq(cpu_smt_mask(cpu), 2)) static_branch_dec_cpuslocked(&sched_smt_present); sched_core_cpu_deactivate(cpu); -- 2.32.0
| |