lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510154750.212913-17-yury.norov@gmail.com>
Date:   Tue, 10 May 2022 08:47:44 -0700
From:   Yury Norov <yury.norov@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        David Laight <David.Laight@...LAB.COM>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joe Perches <joe@...ches.com>,
        Julia Lawall <Julia.Lawall@...ia.fr>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Nicholas Piggin <npiggin@...il.com>,
        Nicolas Palix <nicolas.palix@...g.fr>,
        Peter Zijlstra <peterz@...radead.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Matti Vaittinen <Matti.Vaittinen@...rohmeurope.com>,
        linux-kernel@...r.kernel.org
Cc:     Yury Norov <yury.norov@...il.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Feng Tang <feng.tang@...el.com>,
        "H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org
Subject: [PATCH 16/22] x86/tsc: use cpumask_weight_gt() in loop_timeout()

cpumask_weight_gt() is more efficient because it may stop traversing
cpumask depending on condition.

This piece is not performance-critical, but helps keeping consistency of
cpumask_weight() usage.

CC: Borislav Petkov <bp@...en8.de>
CC: Dave Hansen <dave.hansen@...ux.intel.com>
CC: Feng Tang <feng.tang@...el.com>
CC: H. Peter Anvin <hpa@...or.com>
CC: Ingo Molnar <mingo@...hat.com>
CC: Thomas Gleixner <tglx@...utronix.de>
CC: x86@...nel.org
CC: linux-kernel@...r.kernel.org
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
 arch/x86/kernel/tsc_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 9452dc9664b5..2dc80e6f0a4f 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -340,7 +340,7 @@ static cycles_t check_tsc_warp(unsigned int timeout)
  */
 static inline unsigned int loop_timeout(int cpu)
 {
-	return (cpumask_weight(topology_core_cpumask(cpu)) > 1) ? 2 : 20;
+	return cpumask_weight_gt(topology_core_cpumask(cpu), 1) ? 2 : 20;
 }
 
 /*
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ