Messages in this thread Patch in this message | | | From | Yury Norov <> | Subject | [PATCH 16/22] x86/tsc: use cpumask_weight_gt() in loop_timeout() | Date | Tue, 10 May 2022 08:47:44 -0700 |
| |
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@alien8.de> CC: Dave Hansen <dave.hansen@linux.intel.com> CC: Feng Tang <feng.tang@intel.com> CC: H. Peter Anvin <hpa@zytor.com> CC: Ingo Molnar <mingo@redhat.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: x86@kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Yury Norov <yury.norov@gmail.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
| |