All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: fix need_resched() when checking peempt
@ 2011-05-24 13:27 Hillf Danton
  2011-05-24 13:39 ` Steven Rostedt
  0 siblings, 1 reply; 8+ messages in thread
From: Hillf Danton @ 2011-05-24 13:27 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Peter Zijlstra, Steven Rostedt, Mike Galbraith, Yong Zhang

When checking if current task could be preempted by a newly woken task,
further check could be bypassed if the current thread is different from
the current task of run-queue, and it is corrected accordingly.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- tip-git/kernel/sched_rt.c	Sun May 22 20:12:01 2011
+++ sched_rt.c	Tue May 24 20:31:27 2011
@@ -1074,7 +1074,7 @@ static void check_preempt_curr_rt(struct
 	 * to move current somewhere else, making room for our non-migratable
 	 * task.
 	 */
-	if (p->prio == rq->curr->prio && !need_resched())
+	if (p->prio == rq->curr->prio && !test_tsk_need_resched(rq->curr))
 		check_preempt_equal_prio(rq, p);
 #endif
 }

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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-24 13:27 [PATCH] sched: fix need_resched() when checking peempt Hillf Danton
@ 2011-05-24 13:39 ` Steven Rostedt
  2011-05-24 13:50   ` Hillf Danton
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2011-05-24 13:39 UTC (permalink / raw)
  To: Hillf Danton
  Cc: LKML, Ingo Molnar, Peter Zijlstra, Mike Galbraith, Yong Zhang

On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
> When checking if current task could be preempted by a newly woken task,
> further check could be bypassed if the current thread is different from
> the current task of run-queue, and it is corrected accordingly.

Ug, that change log is an obfuscated mess. But looking at the actual
patch, I figured what you wanted to say. How about this:

----
The RT preempt check tests the wrong task if NEED_RESCHED is set. It
currently checks the local CPU task. It is suppose to check the task
that is running on the run queue we are about to wake another task on.
----


> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>

With a new change log:

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
> 
> --- tip-git/kernel/sched_rt.c	Sun May 22 20:12:01 2011
> +++ sched_rt.c	Tue May 24 20:31:27 2011
> @@ -1074,7 +1074,7 @@ static void check_preempt_curr_rt(struct
>  	 * to move current somewhere else, making room for our non-migratable
>  	 * task.
>  	 */
> -	if (p->prio == rq->curr->prio && !need_resched())
> +	if (p->prio == rq->curr->prio && !test_tsk_need_resched(rq->curr))
>  		check_preempt_equal_prio(rq, p);
>  #endif
>  }



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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-24 13:39 ` Steven Rostedt
@ 2011-05-24 13:50   ` Hillf Danton
  2011-05-25  3:24     ` Yong Zhang
  2011-05-31  3:26     ` Mike Galbraith
  0 siblings, 2 replies; 8+ messages in thread
From: Hillf Danton @ 2011-05-24 13:50 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Ingo Molnar, Peter Zijlstra, Mike Galbraith, Yong Zhang

On Tue, May 24, 2011 at 9:39 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
>> When checking if current task could be preempted by a newly woken task,
>> further check could be bypassed if the current thread is different from
>> the current task of run-queue, and it is corrected accordingly.
>
> Ug, that change log is an obfuscated mess. But looking at the actual
> patch, I figured what you wanted to say. How about this:
>
> ----
> The RT preempt check tests the wrong task if NEED_RESCHED is set. It
> currently checks the local CPU task. It is suppose to check the task
> that is running on the run queue we are about to wake another task on.
> ----
>
Thanks, it is great changelog:)

Hillf

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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-24 13:50   ` Hillf Danton
@ 2011-05-25  3:24     ` Yong Zhang
  2011-05-25  4:34       ` Yong Zhang
  2011-05-31  3:26     ` Mike Galbraith
  1 sibling, 1 reply; 8+ messages in thread
From: Yong Zhang @ 2011-05-25  3:24 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Steven Rostedt, LKML, Ingo Molnar, Peter Zijlstra, Mike Galbraith

On Tue, May 24, 2011 at 9:50 PM, Hillf Danton <dhillf@gmail.com> wrote:
> On Tue, May 24, 2011 at 9:39 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
>>> When checking if current task could be preempted by a newly woken task,
>>> further check could be bypassed if the current thread is different from
>>> the current task of run-queue, and it is corrected accordingly.
>>
>> Ug, that change log is an obfuscated mess. But looking at the actual
>> patch, I figured what you wanted to say. How about this:
>>
>> ----
>> The RT preempt check tests the wrong task if NEED_RESCHED is set. It
>> currently checks the local CPU task. It is suppose to check the task
>> that is running on the run queue we are about to wake another task on.
>> ----
>>
> Thanks, it is great changelog:)

Good catch.

Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>

BTW, this may be the reason for we could trigger
WARN_ON_ONCE(test_tsk_need_resched(next));
https://lkml.org/lkml/2010/12/20/28

Peter, Mike, how do you think about it?

Thanks,
Yong


-- 
Only stand for myself

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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-25  3:24     ` Yong Zhang
@ 2011-05-25  4:34       ` Yong Zhang
  2011-05-25  4:44         ` Mike Galbraith
  0 siblings, 1 reply; 8+ messages in thread
From: Yong Zhang @ 2011-05-25  4:34 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Steven Rostedt, LKML, Ingo Molnar, Peter Zijlstra, Mike Galbraith

On Wed, May 25, 2011 at 11:24 AM, Yong Zhang <yong.zhang0@gmail.com> wrote:
> On Tue, May 24, 2011 at 9:50 PM, Hillf Danton <dhillf@gmail.com> wrote:
>> On Tue, May 24, 2011 at 9:39 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>>> On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
>>>> When checking if current task could be preempted by a newly woken task,
>>>> further check could be bypassed if the current thread is different from
>>>> the current task of run-queue, and it is corrected accordingly.
>>>
>>> Ug, that change log is an obfuscated mess. But looking at the actual
>>> patch, I figured what you wanted to say. How about this:
>>>
>>> ----
>>> The RT preempt check tests the wrong task if NEED_RESCHED is set. It
>>> currently checks the local CPU task. It is suppose to check the task
>>> that is running on the run queue we are about to wake another task on.
>>> ----
>>>
>> Thanks, it is great changelog:)
>
> Good catch.
>
> Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>
>
> BTW, this may be the reason for we could trigger
> WARN_ON_ONCE(test_tsk_need_resched(next));
> https://lkml.org/lkml/2010/12/20/28
>
> Peter, Mike, how do you think about it?

Since rq->lock protects both, that issue needs more digging :)

>
> Thanks,
> Yong
>
>
> --
> Only stand for myself
>



-- 
Only stand for myself

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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-25  4:34       ` Yong Zhang
@ 2011-05-25  4:44         ` Mike Galbraith
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Galbraith @ 2011-05-25  4:44 UTC (permalink / raw)
  To: Yong Zhang
  Cc: Hillf Danton, Steven Rostedt, LKML, Ingo Molnar, Peter Zijlstra

On Wed, 2011-05-25 at 12:34 +0800, Yong Zhang wrote:
> On Wed, May 25, 2011 at 11:24 AM, Yong Zhang <yong.zhang0@gmail.com> wrote:
> > On Tue, May 24, 2011 at 9:50 PM, Hillf Danton <dhillf@gmail.com> wrote:
> >> On Tue, May 24, 2011 at 9:39 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> >>> On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
> >>>> When checking if current task could be preempted by a newly woken task,
> >>>> further check could be bypassed if the current thread is different from
> >>>> the current task of run-queue, and it is corrected accordingly.
> >>>
> >>> Ug, that change log is an obfuscated mess. But looking at the actual
> >>> patch, I figured what you wanted to say. How about this:
> >>>
> >>> ----
> >>> The RT preempt check tests the wrong task if NEED_RESCHED is set. It
> >>> currently checks the local CPU task. It is suppose to check the task
> >>> that is running on the run queue we are about to wake another task on.
> >>> ----
> >>>
> >> Thanks, it is great changelog:)
> >
> > Good catch.
> >
> > Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>
> >
> > BTW, this may be the reason for we could trigger
> > WARN_ON_ONCE(test_tsk_need_resched(next));
> > https://lkml.org/lkml/2010/12/20/28
> >
> > Peter, Mike, how do you think about it?
> 
> Since rq->lock protects both, that issue needs more digging :)

Yeah, good rainy day project.

	-Mike


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

* Re: [PATCH] sched: fix need_resched() when checking peempt
  2011-05-24 13:50   ` Hillf Danton
  2011-05-25  3:24     ` Yong Zhang
@ 2011-05-31  3:26     ` Mike Galbraith
  2011-05-31 13:18       ` [PATCH resend] " Hillf Danton
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Galbraith @ 2011-05-31  3:26 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Steven Rostedt, LKML, Ingo Molnar, Peter Zijlstra, Yong Zhang

On Tue, 2011-05-24 at 21:50 +0800, Hillf Danton wrote:
> On Tue, May 24, 2011 at 9:39 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Tue, 2011-05-24 at 21:27 +0800, Hillf Danton wrote:
> >> When checking if current task could be preempted by a newly woken task,
> >> further check could be bypassed if the current thread is different from
> >> the current task of run-queue, and it is corrected accordingly.
> >
> > Ug, that change log is an obfuscated mess. But looking at the actual
> > patch, I figured what you wanted to say. How about this:
> >
> > ----
> > The RT preempt check tests the wrong task if NEED_RESCHED is set. It
> > currently checks the local CPU task. It is suppose to check the task
> > that is running on the run queue we are about to wake another task on.
> > ----
> >
> Thanks, it is great changelog:)

Has this been queued, or is it awaiting re-submission?

	-Mike


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

* [PATCH resend] sched: fix need_resched() when checking peempt
  2011-05-31  3:26     ` Mike Galbraith
@ 2011-05-31 13:18       ` Hillf Danton
  0 siblings, 0 replies; 8+ messages in thread
From: Hillf Danton @ 2011-05-31 13:18 UTC (permalink / raw)
  To: Mike Galbraith
  Cc: Steven Rostedt, LKML, Ingo Molnar, Peter Zijlstra, Yong Zhang

The RT preempt check tests the wrong task if NEED_RESCHED is set. It currently
checks the local CPU task. It is suppose to check the task that is running on
the run queue we are about to wake another task on.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>
---
 kernel/sched_rt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 88725c9..9b8d5dc 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1096,7 +1096,7 @@ static void check_preempt_curr_rt(struct rq *rq,
struct task_struct *p, int flag
 	 * to move current somewhere else, making room for our non-migratable
 	 * task.
 	 */
-	if (p->prio == rq->curr->prio && !need_resched())
+	if (p->prio == rq->curr->prio && !test_tsk_need_resched(rq->curr))
 		check_preempt_equal_prio(rq, p);
 #endif
 }

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

end of thread, other threads:[~2011-05-31 13:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 13:27 [PATCH] sched: fix need_resched() when checking peempt Hillf Danton
2011-05-24 13:39 ` Steven Rostedt
2011-05-24 13:50   ` Hillf Danton
2011-05-25  3:24     ` Yong Zhang
2011-05-25  4:34       ` Yong Zhang
2011-05-25  4:44         ` Mike Galbraith
2011-05-31  3:26     ` Mike Galbraith
2011-05-31 13:18       ` [PATCH resend] " Hillf Danton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.