public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched_rt: don't use first_cpu on cpumask created with cpumask_and.
@ 2009-01-31 12:51 Rusty Russell
  2009-01-31 13:49 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2009-01-31 12:51 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Mike Travis, Steven Rostedt

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).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/sched_rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched_rt: don't use first_cpu on cpumask created with cpumask_and.
  2009-01-31 12:51 [PATCH] sched_rt: don't use first_cpu on cpumask created with cpumask_and Rusty Russell
@ 2009-01-31 13:49 ` Ingo Molnar
  2009-02-01 10:57   ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2009-01-31 13:49 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, Mike Travis, Steven Rostedt


* Rusty Russell <rusty@rustcorp.com.au> wrote:

> 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).
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched_rt: don't use first_cpu on cpumask created with cpumask_and.
  2009-01-31 13:49 ` Ingo Molnar
@ 2009-02-01 10:57   ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2009-02-01 10:57 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Mike Travis, Steven Rostedt

On Sunday 01 February 2009 00:19:47 Ingo Molnar wrote:
> 
> * Rusty Russell <rusty@rustcorp.com.au> wrote:
> 
> > 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).
> > 
> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> > ---
> >  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?)

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

Thanks,
Rusty.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-01 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31 12:51 [PATCH] sched_rt: don't use first_cpu on cpumask created with cpumask_and Rusty Russell
2009-01-31 13:49 ` Ingo Molnar
2009-02-01 10:57   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox