public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 -tip] sched/deadline: switched_to_dl() -- skip if task is current
@ 2014-01-28  7:26 Kirill Tkhai
  2014-01-28 10:38 ` Juri Lelli
  2014-02-10 13:29 ` [tip:sched/core] sched/deadline: Skip in switched_to_dl() " tip-bot for Kirill Tkhai
  0 siblings, 2 replies; 3+ messages in thread
From: Kirill Tkhai @ 2014-01-28  7:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, mingo, devel, juri.lelli

v2: Changed comment

When p is current and it's not of dl class, then there are no other
dl taks in the rq. If we had had pushable tasks in some other rq,
they would have been pushed earlier. So, skip "p == rq->curr" case.

[This is confirmed by Juri Lelli and LKML was CC'ed, but
 unfotunately I can't find direct link on lkml.org]

Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
CC: Juri Lelli <juri.lelli@gmail.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0de2482..dd19d6d 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1559,7 +1559,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 	if (unlikely(p->dl.dl_throttled))
 		return;
 
-	if (p->on_rq || rq->curr != p) {
+	if (p->on_rq && rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (rq->dl.overloaded && push_dl_task(rq) && rq != task_rq(p))
 			/* Only reschedule if pushing failed */


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

* Re: [PATCH v2 -tip] sched/deadline: switched_to_dl() -- skip if task is current
  2014-01-28  7:26 [PATCH v2 -tip] sched/deadline: switched_to_dl() -- skip if task is current Kirill Tkhai
@ 2014-01-28 10:38 ` Juri Lelli
  2014-02-10 13:29 ` [tip:sched/core] sched/deadline: Skip in switched_to_dl() " tip-bot for Kirill Tkhai
  1 sibling, 0 replies; 3+ messages in thread
From: Juri Lelli @ 2014-01-28 10:38 UTC (permalink / raw)
  To: Kirill Tkhai, linux-kernel; +Cc: peterz, mingo, devel

On 01/28/2014 08:26 AM, Kirill Tkhai wrote:
> v2: Changed comment
> 
> When p is current and it's not of dl class, then there are no other
> dl taks in the rq. If we had had pushable tasks in some other rq,
       ^ tasks

> they would have been pushed earlier. So, skip "p == rq->curr" case.
> 
> [This is confirmed by Juri Lelli and LKML was CC'ed, but
>  unfotunately I can't find direct link on lkml.org]
> 

This was the story:

> On 01/08/2014 10:00 AM, Juri Lelli wrote:
>> On 12/18/2013 04:00 PM, Kirill Tkhai wrote:
>>> 17.12.2013, 16:48, "Peter Zijlstra" <peterz@infradead.org>:
>>> From: Dario Faggioli <raistlin@linux.it>
>>>
>>> Introduces the data structures, constants and symbols needed for
>>> SCHED_DEADLINE implementation.
>>
>> [snipped]
>>
>>> +static void switched_to_dl(struct rq *rq, struct task_struct *p)
>>> +{
>>> +	/*
>>> +	 * If p is throttled, don't consider the possibility
>>> +	 * of preempting rq->curr, the check will be done right
>>> +	 * after its runtime will get replenished.
>>> +	 */
>>> +	if (unlikely(p->dl.dl_throttled))
>>> +		return;
>>> +
>>> +	if (!p->on_rq || rq->curr != p) {
>>> +		if (task_has_dl_policy(rq->curr))
>>> +			check_preempt_curr_dl(rq, p, 0);
>>> +		else
>>> +			resched_task(rq->curr);
>>> +	}
>>> +}
>>
>> The second if() looks a little strange. Why is "!p->on_rq ||" here? RT class
>> has another logic.
>>
>
> You are right, good catch! :)
>
> This has to be changed in
>
>   if (p->on_rq && rq->curr != p)
>
> as in RT.
>
> Thanks,
>
> - Juri

> Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
> CC: Juri Lelli <juri.lelli@gmail.com>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: Ingo Molnar <mingo@kernel.org>
> ---
>  kernel/sched/deadline.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 0de2482..dd19d6d 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1559,7 +1559,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
>  	if (unlikely(p->dl.dl_throttled))
>  		return;
>  
> -	if (p->on_rq || rq->curr != p) {
> +	if (p->on_rq && rq->curr != p) {
>  #ifdef CONFIG_SMP
>  		if (rq->dl.overloaded && push_dl_task(rq) && rq != task_rq(p))
>  			/* Only reschedule if pushing failed */
> 

So the patch looks good. Not sure about the changelog, though :).

Thanks,

- Juri

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

* [tip:sched/core] sched/deadline: Skip in switched_to_dl() if task is current
  2014-01-28  7:26 [PATCH v2 -tip] sched/deadline: switched_to_dl() -- skip if task is current Kirill Tkhai
  2014-01-28 10:38 ` Juri Lelli
@ 2014-02-10 13:29 ` tip-bot for Kirill Tkhai
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Kirill Tkhai @ 2014-02-10 13:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, ktkhai, hpa, mingo, peterz, tglx, juri.lelli

Commit-ID:  390f3258cb2d031f1c17aa32e771ebd336e89073
Gitweb:     http://git.kernel.org/tip/390f3258cb2d031f1c17aa32e771ebd336e89073
Author:     Kirill Tkhai <ktkhai@parallels.com>
AuthorDate: Tue, 28 Jan 2014 11:26:14 +0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 9 Feb 2014 13:31:48 +0100

sched/deadline: Skip in switched_to_dl() if task is current

When p is current and it's not of dl class, then there are no other
dl taks in the rq. If we had had pushable tasks in some other rq,
they would have been pushed earlier. So, skip "p == rq->curr" case.

Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
Acked-by: Juri Lelli <juri.lelli@gmail.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140128072421.32315.25300.stgit@tkhai
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0dd5e09..b5700bc 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1560,7 +1560,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 	if (unlikely(p->dl.dl_throttled))
 		return;
 
-	if (p->on_rq || rq->curr != p) {
+	if (p->on_rq && rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (rq->dl.overloaded && push_dl_task(rq) && rq != task_rq(p))
 			/* Only reschedule if pushing failed */

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

end of thread, other threads:[~2014-02-10 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28  7:26 [PATCH v2 -tip] sched/deadline: switched_to_dl() -- skip if task is current Kirill Tkhai
2014-01-28 10:38 ` Juri Lelli
2014-02-10 13:29 ` [tip:sched/core] sched/deadline: Skip in switched_to_dl() " tip-bot for Kirill Tkhai

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