[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220211101958.GQ23216@worktop.programming.kicks-ass.net>
Date: Fri, 11 Feb 2022 11:19:58 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
David Laight <David.Laight@...lab.com>,
Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Nicholas Piggin <npiggin@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Alexey Klimov <aklimov@...hat.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH 22/49] sched: replace cpumask_weight with cpumask_empty
where appropriate
On Thu, Feb 10, 2022 at 02:49:06PM -0800, Yury Norov wrote:
> In some places, kernel/sched code 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@...il.com>
Neither of these paths are really performance sentitive, but whatever.
Do you want me to take this now, or do you want to merge the whole
series somewere else? In which case:
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> kernel/sched/core.c | 2 +-
> kernel/sched/topology.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 28d1b7af03dc..ed7b392945b7 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -8711,7 +8711,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur,
> {
> int ret = 1;
>
> - if (!cpumask_weight(cur))
> + if (cpumask_empty(cur))
> return ret;
>
> ret = dl_cpuset_cpumask_can_shrink(cur, trial);
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index d201a7052a29..8478e2a8cd65 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -74,7 +74,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
> break;
> }
>
> - if (!cpumask_weight(sched_group_span(group))) {
> + if (cpumask_empty(sched_group_span(group))) {
> printk(KERN_CONT "\n");
> printk(KERN_ERR "ERROR: empty group\n");
> break;
> --
> 2.32.0
>
Powered by blists - more mailing lists