public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RT: Fix special-case exception for preempting the local CPU
@ 2007-10-10 14:49 Gregory Haskins
  2007-10-10 16:22 ` mike kravetz
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Haskins @ 2007-10-10 14:49 UTC (permalink / raw)
  To: mingo, peterz, kravetz, rostedt; +Cc: ghaskins, linux-rt-users, linux-kernel

Applies to 2.6.23-rc9-rt2...  This is another RTO related fix from the thread
two days ago.

---
RT: Fix special-case exception for preempting the local CPU

Check whether the local CPU is eligible to take the task before trying to
preempt it.

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---

 kernel/sched.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3e75c62..b7f7a96 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1869,7 +1869,8 @@ out_activate:
 		 * extra locking in this particular case, because
 		 * we are on the current CPU.)
 		 */
-		if (TASK_PREEMPTS_CURR(p, this_rq))
+		if (TASK_PREEMPTS_CURR(p, this_rq)
+		    && cpu_isset(this_cpu, p->cpus_allowed))
 			set_tsk_need_resched(this_rq->curr);
 		else
 			/*


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

* Re: [PATCH] RT: Fix special-case exception for preempting the local CPU
  2007-10-10 14:49 [PATCH] RT: Fix special-case exception for preempting the local CPU Gregory Haskins
@ 2007-10-10 16:22 ` mike kravetz
  2007-10-11 10:51   ` Ankita Garg
  0 siblings, 1 reply; 3+ messages in thread
From: mike kravetz @ 2007-10-10 16:22 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: mingo, peterz, rostedt, linux-rt-users, linux-kernel

On Wed, Oct 10, 2007 at 10:49:35AM -0400, Gregory Haskins wrote:
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 3e75c62..b7f7a96 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -1869,7 +1869,8 @@ out_activate:
>  		 * extra locking in this particular case, because
>  		 * we are on the current CPU.)
>  		 */
> -		if (TASK_PREEMPTS_CURR(p, this_rq))
> +		if (TASK_PREEMPTS_CURR(p, this_rq)
> +		    && cpu_isset(this_cpu, p->cpus_allowed))
>  			set_tsk_need_resched(this_rq->curr);
>  		else
>  			/*

I wonder if it might better to explicitly take the rq lock and try to
put the task on this_rq in this situation?  Rather than waiting for
schedule to pull it from a remote rq as part of balance_rt_tasks.

A question that has passed through my head a few times is:  When waking
a RT task is it better to:
1) run on current CPU if possible
2) run on CPU task previously ran on

I think #1 may result in lower latency.  But, if the task has lots of
cache warmth the lower wakeup latency may be negated by running on a
'remote' cpu.
-- 
Mike

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

* Re: [PATCH] RT: Fix special-case exception for preempting the local CPU
  2007-10-10 16:22 ` mike kravetz
@ 2007-10-11 10:51   ` Ankita Garg
  0 siblings, 0 replies; 3+ messages in thread
From: Ankita Garg @ 2007-10-11 10:51 UTC (permalink / raw)
  To: mike kravetz
  Cc: Gregory Haskins, mingo, peterz, rostedt, linux-rt-users,
	linux-kernel

On Wed, Oct 10, 2007 at 09:22:48AM -0700, mike kravetz wrote:
> On Wed, Oct 10, 2007 at 10:49:35AM -0400, Gregory Haskins wrote:
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index 3e75c62..b7f7a96 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -1869,7 +1869,8 @@ out_activate:
> >  		 * extra locking in this particular case, because
> >  		 * we are on the current CPU.)
> >  		 */
> > -		if (TASK_PREEMPTS_CURR(p, this_rq))
> > +		if (TASK_PREEMPTS_CURR(p, this_rq)
> > +		    && cpu_isset(this_cpu, p->cpus_allowed))
> >  			set_tsk_need_resched(this_rq->curr);
> >  		else
> >  			/*
> 
> I wonder if it might better to explicitly take the rq lock and try to
> put the task on this_rq in this situation?  Rather than waiting for
> schedule to pull it from a remote rq as part of balance_rt_tasks.
> 
> A question that has passed through my head a few times is:  When waking
> a RT task is it better to:
> 1) run on current CPU if possible
> 2) run on CPU task previously ran on
> 
> I think #1 may result in lower latency.  But, if the task has lots of
> cache warmth the lower wakeup latency may be negated by running on a
> 'remote' cpu.

Could we use task_hot() routine to find if the task is cache hot? If it
isn't, if possible, we could run on current CPU, else, if possible, on
the CPU it last ran on?


-- 
Regards,
Ankita Garg (ankita@in.ibm.com)
Linux Technology Center
IBM India Systems & Technology Labs, 
Bangalore, India   

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

end of thread, other threads:[~2007-10-11 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10 14:49 [PATCH] RT: Fix special-case exception for preempting the local CPU Gregory Haskins
2007-10-10 16:22 ` mike kravetz
2007-10-11 10:51   ` Ankita Garg

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