Skip to contentSkip to conversation

cpumask: Use find_last_bit()

PATCH In review Rusty Russell 1 participant 1 message Dec 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 cpumask: Use find_last_bit()

Impact: cleanup

There's one obvious place to use it: to find the highest possible cpu.

---
 init/main.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
init/main.c +1 -6
diff -r 911f0f14f90b init/main.c
@@ -379,12 +379,7 @@ EXPORT_SYMBOL(nr_cpu_ids);
 /* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
 static void __init setup_nr_cpu_ids(void)
 {
-	int cpu, highest_cpu = 0;
-
-	for_each_possible_cpu(cpu)
-		highest_cpu = cpu;
-
-	nr_cpu_ids = highest_cpu + 1;
+	nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
 }
 
 #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA