aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <[email protected]>2024-02-13 22:06:06 +0100
committerThomas Gleixner <[email protected]>2024-02-15 22:07:44 +0100
commit5e40fb2d4a4c7503cab4f923b7d985dbcf583581 (patch)
tree0e4603206dc66445ad67fb4f33300163f1a60471
parent882e0cff9ef340e7a47659a9aab9da64f4b9b847 (diff)
x86/cpu/topology: Simplify cpu_mark_primary_thread()
No point in creating a mask via fls(). smp_num_siblings is guaranteed to be a power of 2. So just using (smp_num_siblings - 1) has the same effect. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Sohil Mehta <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/x86/kernel/cpu/topology.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index f3397e233ffb..aea408de3be4 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -76,10 +76,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
#ifdef CONFIG_SMP
static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid)
{
- /* Isolate the SMT bit(s) in the APICID and check for 0 */
- u32 mask = (1U << (fls(smp_num_siblings) - 1)) - 1;
-
- if (smp_num_siblings == 1 || !(apicid & mask))
+ if (!(apicid & (smp_num_siblings - 1)))
cpumask_set_cpu(cpu, &__cpu_primary_thread_mask);
}
#else