[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220124080639.GK20638@worktop.programming.kicks-ass.net>
Date: Mon, 24 Jan 2022 09:06:39 +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, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 48/54] kernel/time: replace cpumask_weight with
cpumask_weight_eq where appropriate
On Sun, Jan 23, 2022 at 10:39:19AM -0800, Yury Norov wrote:
> tick_cleanup_dead_cpu() calls cpumask_weight() to compare the weight
> of cpumask with a given number. We can do it more efficiently with
> cpumask_weight_eq() because conditional cpumask_weight may stop
> traversing the cpumask earlier, as soon as condition is met.
But again, nobody gives a crap about performance here..
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
> kernel/time/clockevents.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
> index 003ccf338d20..32d6629a55b2 100644
> --- a/kernel/time/clockevents.c
> +++ b/kernel/time/clockevents.c
> @@ -648,7 +648,7 @@ void tick_cleanup_dead_cpu(int cpu)
> */
> list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
> if (cpumask_test_cpu(cpu, dev->cpumask) &&
> - cpumask_weight(dev->cpumask) == 1 &&
> + cpumask_weight_eq(dev->cpumask, 1) &&
> !tick_is_broadcast_device(dev)) {
> BUG_ON(!clockevent_state_detached(dev));
> list_del(&dev->list);
> --
> 2.30.2
>
Powered by blists - more mailing lists