Skip to contentSkip to conversation

sched_rt: don't use first_cpu on cpumask created with cpumask_and.

PATCH Applied Rusty Russell 2 participants 3 messages Jan 31, 2009 – Feb 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_rt: don't use first_cpu on cpumask created with cpumask_and.

Ingo, please apply to tip/urgent.

cpumask_and() only initializes nr_cpu_ids bits, so the (deprecated) first_cpu() might find one of those uninitialized bits if nr_cpu_ids is less than NR_CPUS (as it can be for CONFIG_CPUMASK_OFFSTACK).

---
 kernel/sched_rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched_rt.c +2 -2
@@ -968,8 +968,8 @@ static inline int pick_optimal_cpu(int t
 	if ((this_cpu != -1) && cpu_isset(this_cpu, *mask))
 		return this_cpu;
 
-	first = first_cpu(*mask);
-	if (first != NR_CPUS)
+	first = cpumask_first(mask);
+	if (first < nr_cpu_ids)
 		return first;
 
 	return -1;
Applied
#1 lore raw
Quoted 10 lines · Rusty Russell

Ingo, please apply to tip/urgent.

cpumask_and() only initializes nr_cpu_ids bits, so the (deprecated) first_cpu() might find one of those uninitialized bits if nr_cpu_ids is less than NR_CPUS (as it can be for CONFIG_CPUMASK_OFFSTACK).

---
 kernel/sched_rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to tip/sched/urgent, thanks Rusty!

Also, Git sorted out the same-content merge with this commit in cpus4096 just fine:

d38b223: cpumask: reduce stack usage in find_lowest_rq

(this commit is where you backported it from i suspect?)

Ingo

#2 lore raw
Quoted 14 lines · On Sunday 01 February 2009 00:19:47 Ingo Molnar wrote:
Quoted 10 lines · Rusty Russell

Ingo, please apply to tip/urgent.

cpumask_and() only initializes nr_cpu_ids bits, so the (deprecated) first_cpu() might find one of those uninitialized bits if nr_cpu_ids is less than NR_CPUS (as it can be for CONFIG_CPUMASK_OFFSTACK).

---
 kernel/sched_rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines

Applied to tip/sched/urgent, thanks Rusty!

Also, Git sorted out the same-content merge with this commit in cpus4096 just fine:

d38b223: cpumask: reduce stack usage in find_lowest_rq

(this commit is where you backported it from i suspect?)

No, this was a clean audit on current Linus' tree. I wanted to make sure that what Linus had worked...

Thanks,
Rusty.