LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue
@ 2015-02-26  2:38 Wanpeng Li
  2015-03-03  9:32 ` Juri Lelli
  0 siblings, 1 reply; 4+ messages in thread
From: Wanpeng Li @ 2015-02-26  2:38 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li

Dl task who is not on queue and it is also the curr task simultaneously
can not happen. In addition, pull since the priority of a not on queue
dl task doesn't make any sense.

This patch fix it by don't pull if dl task who's prio changed is not on
queue.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/deadline.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 49f92c8..ca391c0 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1728,7 +1728,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 static void prio_changed_dl(struct rq *rq, struct task_struct *p,
 			    int oldprio)
 {
-	if (task_on_rq_queued(p) || rq->curr == p) {
+	if (!task_on_rq_queued(p))
+		return;
+
+	if (rq->curr == p) {
 #ifdef CONFIG_SMP
 		/*
 		 * This might be too much, but unfortunately
-- 
1.9.1


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

* Re: [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue
  2015-02-26  2:38 [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue Wanpeng Li
@ 2015-03-03  9:32 ` Juri Lelli
  2015-03-05  1:27   ` Wanpeng Li
  2015-03-05  1:28   ` Wanpeng Li
  0 siblings, 2 replies; 4+ messages in thread
From: Juri Lelli @ 2015-03-03  9:32 UTC (permalink / raw)
  To: Wanpeng Li, Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Kirill Tkhai

Hi,

[+Kirill]

On 26/02/2015 02:38, Wanpeng Li wrote:
> Dl task who is not on queue and it is also the curr task simultaneously
> can not happen. In addition, pull since the priority of a not on queue
> dl task doesn't make any sense.
> 
> This patch fix it by don't pull if dl task who's prio changed is not on
> queue.
> 

So, this is something that was already raised by Kirill, but I always
forgot to fix :/. Thanks for reminding me!

I have this fix:

>From 8fcb04eee2d76042970e9561d253d1bc1fe4cc2b Mon Sep 17 00:00:00 2001
From: Juri Lelli <juri.lelli@arm.com>
Date: Tue, 3 Mar 2015 07:51:56 +0000
Subject: [PATCH] sched/deadline: cleanup prio_changed_dl()

rq->curr task can't be in "dequeued" state in prio_changed_dl()
(The only place we can have that is __schedule()), but it can
be throttled, in which case we shouldn't do balancing.

Also modify the "else" branch, which is dead code (switched_to_dl()
is not interested in dequeued tasks and we are not interested
in balancing in this case), to take into account updates to not
running tasks.

Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Suggested-by: Kirill Tkhai <ktkhai@parallels.com>
Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
 kernel/sched/deadline.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index cfa45c1..9d83748 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1759,7 +1759,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
 static void prio_changed_dl(struct rq *rq, struct task_struct *p,
 			    int oldprio)
 {
-	if (task_on_rq_queued(p) || rq->curr == p) {
+	if (!on_dl_rq(&p->dl))
+		return;
+
+	if (rq->curr == p) {
 #ifdef CONFIG_SMP
 		/*
 		 * This might be too much, but unfortunately
@@ -1786,8 +1789,15 @@ static void prio_changed_dl(struct rq *rq, struct task_struct *p,
 		 */
 		resched_curr(rq);
 #endif /* CONFIG_SMP */
-	} else
-		switched_to_dl(rq, p);
+	} else {
+		/*
+		 * This task is not running, so if its deadline is
+		 * now more imminent than that of the current running
+		 * task then reschedule.
+		 */
+		if (dl_time_before(p->dl.deadline, rq->curr->dl.deadline))
+			resched_curr(rq);
+	}
 }
 
 const struct sched_class dl_sched_class = {
-- 
2.3.0

> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
>  kernel/sched/deadline.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 49f92c8..ca391c0 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1728,7 +1728,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
>  static void prio_changed_dl(struct rq *rq, struct task_struct *p,
>  			    int oldprio)
>  {
> -	if (task_on_rq_queued(p) || rq->curr == p) {
> +	if (!task_on_rq_queued(p))
> +		return;
> +
> +	if (rq->curr == p) {
>  #ifdef CONFIG_SMP
>  		/*
>  		 * This might be too much, but unfortunately
> 


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

* Re: [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue
  2015-03-03  9:32 ` Juri Lelli
@ 2015-03-05  1:27   ` Wanpeng Li
  2015-03-05  1:28   ` Wanpeng Li
  1 sibling, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2015-03-05  1:27 UTC (permalink / raw)
  To: Juri Lelli
  Cc: Ingo Molnar, Peter Zijlstra, Wanpeng Li, linux-kernel, Kirill Tkhai

On Tue, Mar 03, 2015 at 09:32:29AM +0000, Juri Lelli wrote:
>Hi,
>
>[+Kirill]
>
>On 26/02/2015 02:38, Wanpeng Li wrote:
>> Dl task who is not on queue and it is also the curr task simultaneously
>> can not happen. In addition, pull since the priority of a not on queue
>> dl task doesn't make any sense.
>> 
>> This patch fix it by don't pull if dl task who's prio changed is not on
>> queue.
>> 
>
>So, this is something that was already raised by Kirill, but I always
>forgot to fix :/. Thanks for reminding me!
>
>I have this fix:

Cool, your patch looks good to me.

Regards,
Wanpeng Li 

>
>>From 8fcb04eee2d76042970e9561d253d1bc1fe4cc2b Mon Sep 17 00:00:00 2001
>From: Juri Lelli <juri.lelli@arm.com>
>Date: Tue, 3 Mar 2015 07:51:56 +0000
>Subject: [PATCH] sched/deadline: cleanup prio_changed_dl()
>
>rq->curr task can't be in "dequeued" state in prio_changed_dl()
>(The only place we can have that is __schedule()), but it can
>be throttled, in which case we shouldn't do balancing.
>
>Also modify the "else" branch, which is dead code (switched_to_dl()
>is not interested in dequeued tasks and we are not interested
>in balancing in this case), to take into account updates to not
>running tasks.
>
>Signed-off-by: Juri Lelli <juri.lelli@arm.com>
>Suggested-by: Kirill Tkhai <ktkhai@parallels.com>
>Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>Cc: Ingo Molnar <mingo@redhat.com>
>Cc: Peter Zijlstra <peterz@infradead.org>
>Cc: Juri Lelli <juri.lelli@gmail.com>
>Cc: linux-kernel@vger.kernel.org
>---
> kernel/sched/deadline.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
>diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>index cfa45c1..9d83748 100644
>--- a/kernel/sched/deadline.c
>+++ b/kernel/sched/deadline.c
>@@ -1759,7 +1759,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
> static void prio_changed_dl(struct rq *rq, struct task_struct *p,
> 			    int oldprio)
> {
>-	if (task_on_rq_queued(p) || rq->curr == p) {
>+	if (!on_dl_rq(&p->dl))
>+		return;
>+
>+	if (rq->curr == p) {
> #ifdef CONFIG_SMP
> 		/*
> 		 * This might be too much, but unfortunately
>@@ -1786,8 +1789,15 @@ static void prio_changed_dl(struct rq *rq, struct task_struct *p,
> 		 */
> 		resched_curr(rq);
> #endif /* CONFIG_SMP */
>-	} else
>-		switched_to_dl(rq, p);
>+	} else {
>+		/*
>+		 * This task is not running, so if its deadline is
>+		 * now more imminent than that of the current running
>+		 * task then reschedule.
>+		 */
>+		if (dl_time_before(p->dl.deadline, rq->curr->dl.deadline))
>+			resched_curr(rq);
>+	}
> }
> 
> const struct sched_class dl_sched_class = {
>-- 
>2.3.0
>
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>>  kernel/sched/deadline.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index 49f92c8..ca391c0 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -1728,7 +1728,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
>>  static void prio_changed_dl(struct rq *rq, struct task_struct *p,
>>  			    int oldprio)
>>  {
>> -	if (task_on_rq_queued(p) || rq->curr == p) {
>> +	if (!task_on_rq_queued(p))
>> +		return;
>> +
>> +	if (rq->curr == p) {
>>  #ifdef CONFIG_SMP
>>  		/*
>>  		 * This might be too much, but unfortunately
>> 

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

* Re: [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue
  2015-03-03  9:32 ` Juri Lelli
  2015-03-05  1:27   ` Wanpeng Li
@ 2015-03-05  1:28   ` Wanpeng Li
  1 sibling, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2015-03-05  1:28 UTC (permalink / raw)
  To: Juri Lelli
  Cc: Wanpeng Li, Ingo Molnar, Peter Zijlstra, linux-kernel, Kirill Tkhai

Hi Juri,
On Tue, Mar 03, 2015 at 09:32:29AM +0000, Juri Lelli wrote:
>Hi,
>
>[+Kirill]
>
>On 26/02/2015 02:38, Wanpeng Li wrote:
>> Dl task who is not on queue and it is also the curr task simultaneously
>> can not happen. In addition, pull since the priority of a not on queue
>> dl task doesn't make any sense.
>> 
>> This patch fix it by don't pull if dl task who's prio changed is not on
>> queue.
>> 
>
>So, this is something that was already raised by Kirill, but I always
>forgot to fix :/. Thanks for reminding me!
>
>I have this fix:

Cool, your patch looks good to me.

Regards,
Wanpeng Li 

>
>>From 8fcb04eee2d76042970e9561d253d1bc1fe4cc2b Mon Sep 17 00:00:00 2001
>From: Juri Lelli <juri.lelli@arm.com>
>Date: Tue, 3 Mar 2015 07:51:56 +0000
>Subject: [PATCH] sched/deadline: cleanup prio_changed_dl()
>
>rq->curr task can't be in "dequeued" state in prio_changed_dl()
>(The only place we can have that is __schedule()), but it can
>be throttled, in which case we shouldn't do balancing.
>
>Also modify the "else" branch, which is dead code (switched_to_dl()
>is not interested in dequeued tasks and we are not interested
>in balancing in this case), to take into account updates to not
>running tasks.
>
>Signed-off-by: Juri Lelli <juri.lelli@arm.com>
>Suggested-by: Kirill Tkhai <ktkhai@parallels.com>
>Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>Cc: Ingo Molnar <mingo@redhat.com>
>Cc: Peter Zijlstra <peterz@infradead.org>
>Cc: Juri Lelli <juri.lelli@gmail.com>
>Cc: linux-kernel@vger.kernel.org
>---
> kernel/sched/deadline.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
>diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>index cfa45c1..9d83748 100644
>--- a/kernel/sched/deadline.c
>+++ b/kernel/sched/deadline.c
>@@ -1759,7 +1759,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
> static void prio_changed_dl(struct rq *rq, struct task_struct *p,
> 			    int oldprio)
> {
>-	if (task_on_rq_queued(p) || rq->curr == p) {
>+	if (!on_dl_rq(&p->dl))
>+		return;
>+
>+	if (rq->curr == p) {
> #ifdef CONFIG_SMP
> 		/*
> 		 * This might be too much, but unfortunately
>@@ -1786,8 +1789,15 @@ static void prio_changed_dl(struct rq *rq, struct task_struct *p,
> 		 */
> 		resched_curr(rq);
> #endif /* CONFIG_SMP */
>-	} else
>-		switched_to_dl(rq, p);
>+	} else {
>+		/*
>+		 * This task is not running, so if its deadline is
>+		 * now more imminent than that of the current running
>+		 * task then reschedule.
>+		 */
>+		if (dl_time_before(p->dl.deadline, rq->curr->dl.deadline))
>+			resched_curr(rq);
>+	}
> }
> 
> const struct sched_class dl_sched_class = {
>-- 
>2.3.0
>
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>>  kernel/sched/deadline.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index 49f92c8..ca391c0 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -1728,7 +1728,10 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
>>  static void prio_changed_dl(struct rq *rq, struct task_struct *p,
>>  			    int oldprio)
>>  {
>> -	if (task_on_rq_queued(p) || rq->curr == p) {
>> +	if (!task_on_rq_queued(p))
>> +		return;
>> +
>> +	if (rq->curr == p) {
>>  #ifdef CONFIG_SMP
>>  		/*
>>  		 * This might be too much, but unfortunately
>> 

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

end of thread, other threads:[~2015-03-05  1:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26  2:38 [PATCH RESEND] sched/deadline: fix pull if dl task who's prio changed is not on queue Wanpeng Li
2015-03-03  9:32 ` Juri Lelli
2015-03-05  1:27   ` Wanpeng Li
2015-03-05  1:28   ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).