This is a note to let you know that I've just added the patch titled clocksource: Replace cpumask_weight() with cpumask_empty() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: clocksource-replace-cpumask_weight-with-cpumask_empt.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 028bcb4c53e50bf2f5220ec90ec1bd37d8bfb8c4 Author: Yury Norov <yury.norov@xxxxxxxxx> Date: Thu Feb 10 14:49:07 2022 -0800 clocksource: Replace cpumask_weight() with cpumask_empty() [ Upstream commit 8afbcaf8690dac19ebf570a4e4fef9c59c75bf8e ] clocksource_verify_percpu() calls cpumask_weight() to check if any bit of a given cpumask is set. This can be done 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@xxxxxxxxx> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20220210224933.379149-24-yury.norov@xxxxxxxxx Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index e44fb1e12a281..658b90755dd72 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -338,7 +338,7 @@ static void clocksource_verify_percpu(struct clocksource *cs) cpus_read_lock(); preempt_disable(); clocksource_verify_choose_cpus(); - if (cpumask_weight(&cpus_chosen) == 0) { + if (cpumask_empty(&cpus_chosen)) { preempt_enable(); cpus_read_unlock(); pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name);