Skip to contentSkip to conversation

cpumask: use cpu_online in kernel/perf_event.c

PATCH In review Rusty Russell 1 participant 1 message Nov 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 6/14 cpumask: use cpu_online in kernel/perf_event.c

Also, we want to check against nr_cpu_ids, not num_possible_cpus(). The latter works, but the correct bounds check is < nr_cpu_ids.

To: Thomas Gleixner <[email protected]>

---
 kernel/perf_event.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/perf_event.c +2 -2
@@ -1596,7 +1596,7 @@ static struct perf_event_context *find_g
 		if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
 			return ERR_PTR(-EACCES);
 
-		if (cpu < 0 || cpu > num_possible_cpus())
+		if (cpu < 0 || cpu >= nr_cpu_ids)
 			return ERR_PTR(-EINVAL);
 
 		/*
@@ -1604,7 +1604,7 @@ static struct perf_event_context *find_g
 		 * offline CPU and activate it when the CPU comes up, but
 		 * that's for later.
 		 */
-		if (!cpu_isset(cpu, cpu_online_map))
+		if (!cpu_online(cpu))
 			return ERR_PTR(-ENODEV);
 
 		cpuctx = &per_cpu(perf_cpu_context, cpu);