* [PATCH 2/6] sched/dl: fix yield task artificial overrun
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
@ 2014-10-27 1:41 ` Wanpeng Li
2014-10-29 16:33 ` Juri Lelli
2014-10-27 1:41 ` [PATCH 3/6] sched/dl: add deadline rq status print Wanpeng Li
` (4 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-27 1:41 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li
The yield semantic of deadline class is to reduce remaining runtime to
zero, and then update_curr_dl() will stop it. However, comsumed bandwidth
is reduced from the budget of yield task again even if it has already been
set to zero which leads to artificial overrun. This patch fix it by reduce
remaining runtime to zero if there is still remaining runtime after comsumed
bandwidth is accumulated.
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/deadline.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index abfaf3d..d4ffc1e 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -568,7 +568,12 @@ static
int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se)
{
int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq));
- int rorun = dl_se->runtime <= 0;
+ int rorun;
+
+ if (dl_se->dl_yielded && dl_se->runtime > 0)
+ dl_se->runtime = 0;
+
+ rorun = dl_se->runtime <= 0;
if (!rorun && !dmiss)
return 0;
@@ -897,10 +902,8 @@ static void yield_task_dl(struct rq *rq)
* it and the bandwidth timer will wake it up and will give it
* new scheduling parameters (thanks to dl_yielded=1).
*/
- if (p->dl.runtime > 0) {
+ if (p->dl.runtime > 0)
rq->curr->dl.dl_yielded = 1;
- p->dl.runtime = 0;
- }
update_curr_dl(rq);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 2/6] sched/dl: fix yield task artificial overrun
2014-10-27 1:41 ` [PATCH 2/6] sched/dl: fix yield task artificial overrun Wanpeng Li
@ 2014-10-29 16:33 ` Juri Lelli
2014-10-29 22:49 ` Wanpeng Li
0 siblings, 1 reply; 19+ messages in thread
From: Juri Lelli @ 2014-10-29 16:33 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel@vger.kernel.org
Hi,
On 27/10/14 01:41, Wanpeng Li wrote:
> The yield semantic of deadline class is to reduce remaining runtime to
> zero, and then update_curr_dl() will stop it. However, comsumed bandwidth
> is reduced from the budget of yield task again even if it has already been
> set to zero which leads to artificial overrun. This patch fix it by reduce
> remaining runtime to zero if there is still remaining runtime after comsumed
> bandwidth is accumulated.
>
Oh, right. But, how about what below instead (with a proper comment
and changelog)?
Thanks,
- Juri
>From 108ecdff52b154ea2c79d4aac552ddf1ead871c7 Mon Sep 17 00:00:00 2001
From: Juri Lelli <juri.lelli@arm.com>
Date: Wed, 29 Oct 2014 16:09:06 +0000
Subject: [PATCH] sched/deadline: fix artificial overrun introduced by
yield_task_dl
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
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 2e31a30..db6ad38 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -633,7 +633,7 @@ static void update_curr_dl(struct rq *rq)
sched_rt_avg_update(rq, delta_exec);
- dl_se->runtime -= delta_exec;
+ dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
if (dl_runtime_exceeded(rq, dl_se)) {
__dequeue_task_dl(rq, curr, 0);
if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
--
2.1.2
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/deadline.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index abfaf3d..d4ffc1e 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -568,7 +568,12 @@ static
> int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se)
> {
> int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq));
> - int rorun = dl_se->runtime <= 0;
> + int rorun;
> +
> + if (dl_se->dl_yielded && dl_se->runtime > 0)
> + dl_se->runtime = 0;
> +
> + rorun = dl_se->runtime <= 0;
>
> if (!rorun && !dmiss)
> return 0;
> @@ -897,10 +902,8 @@ static void yield_task_dl(struct rq *rq)
> * it and the bandwidth timer will wake it up and will give it
> * new scheduling parameters (thanks to dl_yielded=1).
> */
> - if (p->dl.runtime > 0) {
> + if (p->dl.runtime > 0)
> rq->curr->dl.dl_yielded = 1;
> - p->dl.runtime = 0;
> - }
> update_curr_dl(rq);
> }
>
>
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 2/6] sched/dl: fix yield task artificial overrun
2014-10-29 16:33 ` Juri Lelli
@ 2014-10-29 22:49 ` Wanpeng Li
2014-10-30 10:04 ` Juri Lelli
0 siblings, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-29 22:49 UTC (permalink / raw)
To: Juri Lelli, Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org
Hi Juri,
2014/10/30 0:33, Juri Lelli:
> Hi,
>
> On 27/10/14 01:41, Wanpeng Li wrote:
>> The yield semantic of deadline class is to reduce remaining runtime to
>> zero, and then update_curr_dl() will stop it. However, comsumed bandwidth
>> is reduced from the budget of yield task again even if it has already been
>> set to zero which leads to artificial overrun. This patch fix it by reduce
>> remaining runtime to zero if there is still remaining runtime after comsumed
>> bandwidth is accumulated.
>>
> Oh, right. But, how about what below instead (with a proper comment
> and changelog)?
>
> Thanks,
>
> - Juri
>
> From 108ecdff52b154ea2c79d4aac552ddf1ead871c7 Mon Sep 17 00:00:00 2001
> From: Juri Lelli <juri.lelli@arm.com>
> Date: Wed, 29 Oct 2014 16:09:06 +0000
> Subject: [PATCH] sched/deadline: fix artificial overrun introduced by
> yield_task_dl
>
> Signed-off-by: Juri Lelli <juri.lelli@arm.com>
> ---
> 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 2e31a30..db6ad38 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -633,7 +633,7 @@ static void update_curr_dl(struct rq *rq)
>
> sched_rt_avg_update(rq, delta_exec);
>
> - dl_se->runtime -= delta_exec;
> + dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
+ if (dl_se->dl_yielded && dl_se->runtime > 0)
+ dl_se->runtime = 0;
Maybe this can be moved to update_curr_dl().
I think the consumed bandwidth still should be reduced from remaining
runtime even if yield, then the remaining runtime will be reset to 0 if
there is still remaining runtime as what my patch do. What's your option?
Regards,
Wanpeng Li
> if (dl_runtime_exceeded(rq, dl_se)) {
> __dequeue_task_dl(rq, curr, 0);
> if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 2/6] sched/dl: fix yield task artificial overrun
2014-10-29 22:49 ` Wanpeng Li
@ 2014-10-30 10:04 ` Juri Lelli
0 siblings, 0 replies; 19+ messages in thread
From: Juri Lelli @ 2014-10-30 10:04 UTC (permalink / raw)
To: Wanpeng Li, Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi,
On 29/10/14 22:49, Wanpeng Li wrote:
> Hi Juri,
> 2014/10/30 0:33, Juri Lelli:
>> Hi,
>>
>> On 27/10/14 01:41, Wanpeng Li wrote:
>>> The yield semantic of deadline class is to reduce remaining runtime to
>>> zero, and then update_curr_dl() will stop it. However, comsumed bandwidth
>>> is reduced from the budget of yield task again even if it has already been
>>> set to zero which leads to artificial overrun. This patch fix it by reduce
>>> remaining runtime to zero if there is still remaining runtime after comsumed
>>> bandwidth is accumulated.
>>>
>> Oh, right. But, how about what below instead (with a proper comment
>> and changelog)?
>>
>> Thanks,
>>
>> - Juri
>>
>> From 108ecdff52b154ea2c79d4aac552ddf1ead871c7 Mon Sep 17 00:00:00 2001
>> From: Juri Lelli <juri.lelli@arm.com>
>> Date: Wed, 29 Oct 2014 16:09:06 +0000
>> Subject: [PATCH] sched/deadline: fix artificial overrun introduced by
>> yield_task_dl
>>
>> Signed-off-by: Juri Lelli <juri.lelli@arm.com>
>> ---
>> 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 2e31a30..db6ad38 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -633,7 +633,7 @@ static void update_curr_dl(struct rq *rq)
>>
>> sched_rt_avg_update(rq, delta_exec);
>>
>> - dl_se->runtime -= delta_exec;
>> + dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
>
> + if (dl_se->dl_yielded && dl_se->runtime > 0)
> + dl_se->runtime = 0;
>
We already did this in yield_task_dl(). In update_curr_dl() we now
just have to make sure we don't steal some more runtime from the
task that yielded (but we do all other accounting).
Thanks,
- Juri
> Maybe this can be moved to update_curr_dl().
>
> I think the consumed bandwidth still should be reduced from remaining
> runtime even if yield, then the remaining runtime will be reset to 0 if
> there is still remaining runtime as what my patch do. What's your option?
>
> Regards,
> Wanpeng Li
>
>> if (dl_runtime_exceeded(rq, dl_se)) {
>> __dequeue_task_dl(rq, curr, 0);
>> if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/6] sched/dl: add deadline rq status print
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
2014-10-27 1:41 ` [PATCH 2/6] sched/dl: fix yield task artificial overrun Wanpeng Li
@ 2014-10-27 1:41 ` Wanpeng Li
2014-10-29 16:52 ` Juri Lelli
2014-10-27 1:41 ` [PATCH 4/6] sched/dl: push task away if the deadline is equal to curr during wakeup Wanpeng Li
` (3 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-27 1:41 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li
This patch add deadline rq status print.
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/deadline.c | 9 +++++++++
kernel/sched/debug.c | 7 +++++++
kernel/sched/sched.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index d4ffc1e..aa7c27f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1682,3 +1682,12 @@ const struct sched_class dl_sched_class = {
.switched_from = switched_from_dl,
.switched_to = switched_to_dl,
};
+
+#ifdef CONFIG_SCHED_DEBUG
+extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
+
+void print_dl_stats(struct seq_file *m, int cpu)
+{
+ print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
+}
+#endif /* CONFIG_SCHED_DEBUG */
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index ce33780..eeb6046 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -261,6 +261,12 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
#undef P
}
+void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
+{
+ SEQ_printf(m, "\ndl_rq[%d]:\n", cpu);
+ SEQ_printf(m, " .%-30s: %ld\n", "dl_nr_running", dl_rq->dl_nr_running);
+}
+
extern __read_mostly int sched_clock_running;
static void print_cpu(struct seq_file *m, int cpu)
@@ -329,6 +335,7 @@ do { \
spin_lock_irqsave(&sched_debug_lock, flags);
print_cfs_stats(m, cpu);
print_rt_stats(m, cpu);
+ print_dl_stats(m, cpu);
print_rq(m, rq, cpu);
spin_unlock_irqrestore(&sched_debug_lock, flags);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 6130251..2c2ef3c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1502,6 +1502,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
extern void print_cfs_stats(struct seq_file *m, int cpu);
extern void print_rt_stats(struct seq_file *m, int cpu);
+extern void print_dl_stats(struct seq_file *m, int cpu);
extern void init_cfs_rq(struct cfs_rq *cfs_rq);
extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);
--
1.9.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 3/6] sched/dl: add deadline rq status print
2014-10-27 1:41 ` [PATCH 3/6] sched/dl: add deadline rq status print Wanpeng Li
@ 2014-10-29 16:52 ` Juri Lelli
2014-10-29 22:52 ` Wanpeng Li
0 siblings, 1 reply; 19+ messages in thread
From: Juri Lelli @ 2014-10-29 16:52 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi,
On 27/10/14 01:41, Wanpeng Li wrote:
> This patch add deadline rq status print.
>
Don't know if useful, but we could add this, just to be consistent.
Thanks,
- Juri
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/deadline.c | 9 +++++++++
> kernel/sched/debug.c | 7 +++++++
> kernel/sched/sched.h | 1 +
> 3 files changed, 17 insertions(+)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index d4ffc1e..aa7c27f 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1682,3 +1682,12 @@ const struct sched_class dl_sched_class = {
> .switched_from = switched_from_dl,
> .switched_to = switched_to_dl,
> };
> +
> +#ifdef CONFIG_SCHED_DEBUG
> +extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
> +
> +void print_dl_stats(struct seq_file *m, int cpu)
> +{
> + print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
> +}
> +#endif /* CONFIG_SCHED_DEBUG */
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index ce33780..eeb6046 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -261,6 +261,12 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
> #undef P
> }
>
> +void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
> +{
> + SEQ_printf(m, "\ndl_rq[%d]:\n", cpu);
> + SEQ_printf(m, " .%-30s: %ld\n", "dl_nr_running", dl_rq->dl_nr_running);
> +}
> +
> extern __read_mostly int sched_clock_running;
>
> static void print_cpu(struct seq_file *m, int cpu)
> @@ -329,6 +335,7 @@ do { \
> spin_lock_irqsave(&sched_debug_lock, flags);
> print_cfs_stats(m, cpu);
> print_rt_stats(m, cpu);
> + print_dl_stats(m, cpu);
>
> print_rq(m, rq, cpu);
> spin_unlock_irqrestore(&sched_debug_lock, flags);
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 6130251..2c2ef3c 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1502,6 +1502,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
> extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
> extern void print_cfs_stats(struct seq_file *m, int cpu);
> extern void print_rt_stats(struct seq_file *m, int cpu);
> +extern void print_dl_stats(struct seq_file *m, int cpu);
>
> extern void init_cfs_rq(struct cfs_rq *cfs_rq);
> extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 3/6] sched/dl: add deadline rq status print
2014-10-29 16:52 ` Juri Lelli
@ 2014-10-29 22:52 ` Wanpeng Li
0 siblings, 0 replies; 19+ messages in thread
From: Wanpeng Li @ 2014-10-29 22:52 UTC (permalink / raw)
To: Juri Lelli, Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi Juri,
2014/10/30 0:52, Juri Lelli:
> Hi,
>
> On 27/10/14 01:41, Wanpeng Li wrote:
>> This patch add deadline rq status print.
>>
> Don't know if useful, but we could add this, just to be consistent.
Yes, to keep it consistent. Maybe more things can be print if they are
necessary in the future.
Regards,
Wanpeng Li
>
> Thanks,
>
> - Juri
>
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>> kernel/sched/deadline.c | 9 +++++++++
>> kernel/sched/debug.c | 7 +++++++
>> kernel/sched/sched.h | 1 +
>> 3 files changed, 17 insertions(+)
>>
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index d4ffc1e..aa7c27f 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -1682,3 +1682,12 @@ const struct sched_class dl_sched_class = {
>> .switched_from = switched_from_dl,
>> .switched_to = switched_to_dl,
>> };
>> +
>> +#ifdef CONFIG_SCHED_DEBUG
>> +extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
>> +
>> +void print_dl_stats(struct seq_file *m, int cpu)
>> +{
>> + print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
>> +}
>> +#endif /* CONFIG_SCHED_DEBUG */
>> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
>> index ce33780..eeb6046 100644
>> --- a/kernel/sched/debug.c
>> +++ b/kernel/sched/debug.c
>> @@ -261,6 +261,12 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
>> #undef P
>> }
>>
>> +void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
>> +{
>> + SEQ_printf(m, "\ndl_rq[%d]:\n", cpu);
>> + SEQ_printf(m, " .%-30s: %ld\n", "dl_nr_running", dl_rq->dl_nr_running);
>> +}
>> +
>> extern __read_mostly int sched_clock_running;
>>
>> static void print_cpu(struct seq_file *m, int cpu)
>> @@ -329,6 +335,7 @@ do { \
>> spin_lock_irqsave(&sched_debug_lock, flags);
>> print_cfs_stats(m, cpu);
>> print_rt_stats(m, cpu);
>> + print_dl_stats(m, cpu);
>>
>> print_rq(m, rq, cpu);
>> spin_unlock_irqrestore(&sched_debug_lock, flags);
>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> index 6130251..2c2ef3c 100644
>> --- a/kernel/sched/sched.h
>> +++ b/kernel/sched/sched.h
>> @@ -1502,6 +1502,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
>> extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
>> extern void print_cfs_stats(struct seq_file *m, int cpu);
>> extern void print_rt_stats(struct seq_file *m, int cpu);
>> +extern void print_dl_stats(struct seq_file *m, int cpu);
>>
>> extern void init_cfs_rq(struct cfs_rq *cfs_rq);
>> extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 4/6] sched/dl: push task away if the deadline is equal to curr during wakeup
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
2014-10-27 1:41 ` [PATCH 2/6] sched/dl: fix yield task artificial overrun Wanpeng Li
2014-10-27 1:41 ` [PATCH 3/6] sched/dl: add deadline rq status print Wanpeng Li
@ 2014-10-27 1:41 ` Wanpeng Li
2014-10-29 17:08 ` Juri Lelli
2014-10-27 1:41 ` [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task Wanpeng Li
` (2 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-27 1:41 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li
This patch pushes task away if the dealine of the task is equal
to current during wake up. The same behavior as rt class.
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
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 aa7c27f..97141e2 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1492,7 +1492,7 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
p->nr_cpus_allowed > 1 &&
dl_task(rq->curr) &&
(rq->curr->nr_cpus_allowed < 2 ||
- dl_entity_preempt(&rq->curr->dl, &p->dl))) {
+ !dl_entity_preempt(&p->dl, &rq->curr->dl))) {
push_dl_tasks(rq);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 4/6] sched/dl: push task away if the deadline is equal to curr during wakeup
2014-10-27 1:41 ` [PATCH 4/6] sched/dl: push task away if the deadline is equal to curr during wakeup Wanpeng Li
@ 2014-10-29 17:08 ` Juri Lelli
0 siblings, 0 replies; 19+ messages in thread
From: Juri Lelli @ 2014-10-29 17:08 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi,
On 27/10/14 01:41, Wanpeng Li wrote:
> This patch pushes task away if the dealine of the task is equal
> to current during wake up. The same behavior as rt class.
>
Right.
Thanks,
- Juri
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> 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 aa7c27f..97141e2 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1492,7 +1492,7 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
> p->nr_cpus_allowed > 1 &&
> dl_task(rq->curr) &&
> (rq->curr->nr_cpus_allowed < 2 ||
> - dl_entity_preempt(&rq->curr->dl, &p->dl))) {
> + !dl_entity_preempt(&p->dl, &rq->curr->dl))) {
> push_dl_tasks(rq);
> }
> }
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
` (2 preceding siblings ...)
2014-10-27 1:41 ` [PATCH 4/6] sched/dl: push task away if the deadline is equal to curr during wakeup Wanpeng Li
@ 2014-10-27 1:41 ` Wanpeng Li
2014-10-29 22:59 ` Wanpeng Li
2014-10-30 10:21 ` Juri Lelli
2014-10-27 1:41 ` [PATCH 6/6] sched/dl: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
2014-10-29 22:57 ` [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
5 siblings, 2 replies; 19+ messages in thread
From: Wanpeng Li @ 2014-10-27 1:41 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li
Reschedule if successfully pull earlier deadline task.
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/deadline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 97141e2..21de865 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1583,8 +1583,8 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
* this is the right place to try to pull some other one
* from an overloaded cpu, if any.
*/
- if (!rq->dl.dl_nr_running)
- pull_dl_task(rq);
+ if (!rq->dl.dl_nr_running && pull_dl_task(rq))
+ resched_curr(rq);
#endif
}
--
1.9.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-27 1:41 ` [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task Wanpeng Li
@ 2014-10-29 22:59 ` Wanpeng Li
2014-10-30 10:21 ` Juri Lelli
1 sibling, 0 replies; 19+ messages in thread
From: Wanpeng Li @ 2014-10-29 22:59 UTC (permalink / raw)
To: Juri Lelli; +Cc: Wanpeng Li, Ingo Molnar, Peter Zijlstra, linux-kernel
Hi Juri, could you review 5/6 and 6/6? 5/6 is the same behavior as rt
class. ;-)
2014/10/27 9:41, Wanpeng Li:
> Reschedule if successfully pull earlier deadline task.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/deadline.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 97141e2..21de865 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1583,8 +1583,8 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
> * this is the right place to try to pull some other one
> * from an overloaded cpu, if any.
> */
> - if (!rq->dl.dl_nr_running)
> - pull_dl_task(rq);
> + if (!rq->dl.dl_nr_running && pull_dl_task(rq))
> + resched_curr(rq);
> #endif
> }
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-27 1:41 ` [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task Wanpeng Li
2014-10-29 22:59 ` Wanpeng Li
@ 2014-10-30 10:21 ` Juri Lelli
2014-10-30 13:12 ` Wanpeng Li
2014-10-31 15:37 ` Peter Zijlstra
1 sibling, 2 replies; 19+ messages in thread
From: Juri Lelli @ 2014-10-30 10:21 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi,
On 27/10/14 01:41, Wanpeng Li wrote:
> Reschedule if successfully pull earlier deadline task.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/deadline.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 97141e2..21de865 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1583,8 +1583,8 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
> * this is the right place to try to pull some other one
> * from an overloaded cpu, if any.
> */
> - if (!rq->dl.dl_nr_running)
> - pull_dl_task(rq);
> + if (!rq->dl.dl_nr_running && pull_dl_task(rq))
> + resched_curr(rq);
Right, we have to reschedule. But, how about we fully align to -rt?
Peter, is the task_on_rq_queued() check for cases in which p is not
enqueued but its class changes after a setscheduler/rt_mutex_setprio?
Thanks,
- Juri
>From 404749782e493cb6019193f347163b640ebd552d Mon Sep 17 00:00:00 2001
From: Juri Lelli <juri.lelli@arm.com>
Date: Thu, 30 Oct 2014 10:15:40 +0000
Subject: [PATCH] sched/deadline: reschedule from switched_from_dl() after a
successful pull
In switched_from_dl() we have to issue a resched if we
successfully pulled some task from other cpus.
This patch also aligns the behaviour with -rt.
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/deadline.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index db6ad38..e8943fc 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1623,8 +1623,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
* this is the right place to try to pull some other one
* from an overloaded cpu, if any.
*/
- if (!rq->dl.dl_nr_running)
- pull_dl_task(rq);
+ if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
+ return;
+
+ if (pull_dl_task(rq))
+ resched_curr(rq);
#endif
}
--
2.1.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-30 10:21 ` Juri Lelli
@ 2014-10-30 13:12 ` Wanpeng Li
2014-10-30 14:42 ` Juri Lelli
2014-10-31 15:37 ` Peter Zijlstra
1 sibling, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-30 13:12 UTC (permalink / raw)
To: Juri Lelli
Cc: Ingo Molnar, Peter Zijlstra, linux-kernel@vger.kernel.org,
juri.lelli@gmail.com
Hi Juri,
On Thu, Oct 30, 2014 at 10:21:00AM +0000, Juri Lelli wrote:
>Hi,
>
>On 27/10/14 01:41, Wanpeng Li wrote:
>> Reschedule if successfully pull earlier deadline task.
>>
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>> kernel/sched/deadline.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index 97141e2..21de865 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -1583,8 +1583,8 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
>> * this is the right place to try to pull some other one
>> * from an overloaded cpu, if any.
>> */
>> - if (!rq->dl.dl_nr_running)
>> - pull_dl_task(rq);
>> + if (!rq->dl.dl_nr_running && pull_dl_task(rq))
>> + resched_curr(rq);
>
>Right, we have to reschedule. But, how about we fully align to -rt?
>
>Peter, is the task_on_rq_queued() check for cases in which p is not
>enqueued but its class changes after a setscheduler/rt_mutex_setprio?
>
>Thanks,
>
>- Juri
>
>>From 404749782e493cb6019193f347163b640ebd552d Mon Sep 17 00:00:00 2001
>From: Juri Lelli <juri.lelli@arm.com>
>Date: Thu, 30 Oct 2014 10:15:40 +0000
>Subject: [PATCH] sched/deadline: reschedule from switched_from_dl() after a
> successful pull
>
>In switched_from_dl() we have to issue a resched if we
>successfully pulled some task from other cpus.
>This patch also aligns the behaviour with -rt.
>
Good idea.
>Signed-off-by: Juri Lelli <juri.lelli@arm.com>
I will send out version two of this patchset with the update of 2/6 and
5/6 with *your Suggested-by*. Thanks for your great proposal. ;-)
Regards,
Wanpeng Li
>Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>---
> kernel/sched/deadline.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>index db6ad38..e8943fc 100644
>--- a/kernel/sched/deadline.c
>+++ b/kernel/sched/deadline.c
>@@ -1623,8 +1623,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
> * this is the right place to try to pull some other one
> * from an overloaded cpu, if any.
> */
>- if (!rq->dl.dl_nr_running)
>- pull_dl_task(rq);
>+ if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
>+ return;
>+
>+ if (pull_dl_task(rq))
>+ resched_curr(rq);
> #endif
> }
>
>--
>2.1.2
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-30 13:12 ` Wanpeng Li
@ 2014-10-30 14:42 ` Juri Lelli
0 siblings, 0 replies; 19+ messages in thread
From: Juri Lelli @ 2014-10-30 14:42 UTC (permalink / raw)
To: Wanpeng Li
Cc: Ingo Molnar, Peter Zijlstra, linux-kernel@vger.kernel.org,
juri.lelli@gmail.com
Hi,
On 30/10/14 13:12, Wanpeng Li wrote:
> Hi Juri,
> On Thu, Oct 30, 2014 at 10:21:00AM +0000, Juri Lelli wrote:
>> Hi,
>>
>> On 27/10/14 01:41, Wanpeng Li wrote:
>>> Reschedule if successfully pull earlier deadline task.
>>>
>>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>>> ---
>>> kernel/sched/deadline.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>>> index 97141e2..21de865 100644
>>> --- a/kernel/sched/deadline.c
>>> +++ b/kernel/sched/deadline.c
>>> @@ -1583,8 +1583,8 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
>>> * this is the right place to try to pull some other one
>>> * from an overloaded cpu, if any.
>>> */
>>> - if (!rq->dl.dl_nr_running)
>>> - pull_dl_task(rq);
>>> + if (!rq->dl.dl_nr_running && pull_dl_task(rq))
>>> + resched_curr(rq);
>>
>> Right, we have to reschedule. But, how about we fully align to -rt?
>>
>> Peter, is the task_on_rq_queued() check for cases in which p is not
>> enqueued but its class changes after a setscheduler/rt_mutex_setprio?
>>
>> Thanks,
>>
>> - Juri
>>
>> >From 404749782e493cb6019193f347163b640ebd552d Mon Sep 17 00:00:00 2001
>> From: Juri Lelli <juri.lelli@arm.com>
>> Date: Thu, 30 Oct 2014 10:15:40 +0000
>> Subject: [PATCH] sched/deadline: reschedule from switched_from_dl() after a
>> successful pull
>>
>> In switched_from_dl() we have to issue a resched if we
>> successfully pulled some task from other cpus.
>> This patch also aligns the behaviour with -rt.
>>
>
> Good idea.
>
>> Signed-off-by: Juri Lelli <juri.lelli@arm.com>
>
> I will send out version two of this patchset with the update of 2/6 and
> 5/6 with *your Suggested-by*. Thanks for your great proposal. ;-)
>
Well, I've actually *wrote* (especially 2/6 is a different fix w.r.t.
your version) and *tested* the updates . But, I'm not really getting
anxious about signing patches, so fair enough.
Thanks,
- Juri
> Regards,
> Wanpeng Li
>
>> Suggested-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>> kernel/sched/deadline.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index db6ad38..e8943fc 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -1623,8 +1623,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
>> * this is the right place to try to pull some other one
>> * from an overloaded cpu, if any.
>> */
>> - if (!rq->dl.dl_nr_running)
>> - pull_dl_task(rq);
>> + if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
>> + return;
>> +
>> + if (pull_dl_task(rq))
>> + resched_curr(rq);
>> #endif
>> }
>>
>> --
>> 2.1.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task
2014-10-30 10:21 ` Juri Lelli
2014-10-30 13:12 ` Wanpeng Li
@ 2014-10-31 15:37 ` Peter Zijlstra
1 sibling, 0 replies; 19+ messages in thread
From: Peter Zijlstra @ 2014-10-31 15:37 UTC (permalink / raw)
To: Juri Lelli
Cc: Wanpeng Li, Ingo Molnar, linux-kernel@vger.kernel.org,
juri.lelli@gmail.com
On Thu, Oct 30, 2014 at 10:21:00AM +0000, Juri Lelli wrote:
> Peter, is the task_on_rq_queued() check for cases in which p is not
> enqueued but its class changes after a setscheduler/rt_mutex_setprio?
Yes, in particular if the task wasn't on the rq we won't change the rq
by changing the class and therefore we don't need to attempt to pull.
---
commit da7a735e51f9622eb3e1672594d4a41da01d7e4f
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Mon Jan 17 17:03:27 2011 +0100
sched: Fix switch_from_fair()
When a task is taken out of the fair class we must ensure the vruntime
is properly normalized because when we put it back in it will assume
to be normalized.
The case that goes wrong is when changing away from the fair class
while sleeping. Sleeping tasks have non-normalized vruntime in order
to make sleeper-fairness work. So treat the switch away from fair as a
wakeup and preserve the relative vruntime.
Also update sysrq-n to call the ->switch_{to,from} methods.
Reported-by: Onkalo Samu <samu.p.onkalo@nokia.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 6/6] sched/dl: don't check CONFIG_SMP in switched_from_dl
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
` (3 preceding siblings ...)
2014-10-27 1:41 ` [PATCH 5/6] sched/dl: reschedule if successfully pull earlier deadline task Wanpeng Li
@ 2014-10-27 1:41 ` Wanpeng Li
2014-10-30 10:29 ` Juri Lelli
2014-10-29 22:57 ` [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
5 siblings, 1 reply; 19+ messages in thread
From: Wanpeng Li @ 2014-10-27 1:41 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Juri Lelli, linux-kernel, Wanpeng Li
There are both UP and SMP version of pull_dl_task(), so don't need
to check CONFIG_SMP in switched_from_dl();
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
kernel/sched/deadline.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 21de865..35d6dd5 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1577,7 +1577,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
__dl_clear_params(p);
-#ifdef CONFIG_SMP
/*
* Since this might be the only -deadline task on the rq,
* this is the right place to try to pull some other one
@@ -1585,7 +1584,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
*/
if (!rq->dl.dl_nr_running && pull_dl_task(rq))
resched_curr(rq);
-#endif
}
/*
--
1.9.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 6/6] sched/dl: don't check CONFIG_SMP in switched_from_dl
2014-10-27 1:41 ` [PATCH 6/6] sched/dl: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
@ 2014-10-30 10:29 ` Juri Lelli
0 siblings, 0 replies; 19+ messages in thread
From: Juri Lelli @ 2014-10-30 10:29 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: linux-kernel@vger.kernel.org, juri.lelli@gmail.com
Hi,
On 27/10/14 01:41, Wanpeng Li wrote:
> There are both UP and SMP version of pull_dl_task(), so don't need
> to check CONFIG_SMP in switched_from_dl();
>
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/deadline.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 21de865..35d6dd5 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1577,7 +1577,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
>
> __dl_clear_params(p);
>
> -#ifdef CONFIG_SMP
> /*
> * Since this might be the only -deadline task on the rq,
> * this is the right place to try to pull some other one
> @@ -1585,7 +1584,6 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
> */
> if (!rq->dl.dl_nr_running && pull_dl_task(rq))
> resched_curr(rq);
> -#endif
> }
>
> /*
>
Yes, we can remove it.
Thanks,
- Juri
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance
2014-10-27 1:41 [PATCH 1/6] sched/rt: check if curr can be pushed/pulled somewhere else in advance Wanpeng Li
` (4 preceding siblings ...)
2014-10-27 1:41 ` [PATCH 6/6] sched/dl: don't check CONFIG_SMP in switched_from_dl Wanpeng Li
@ 2014-10-29 22:57 ` Wanpeng Li
5 siblings, 0 replies; 19+ messages in thread
From: Wanpeng Li @ 2014-10-29 22:57 UTC (permalink / raw)
To: Wanpeng Li, Ingo Molnar, Peter Zijlstra
Cc: Juri Lelli, linux-kernel, Kirill Tkhai, Kirill Tkhai
Cc Kirill,
2014/10/27 9:41, Wanpeng Li:
> This patch checks if current can be pushed/pulled somewhere else
> in advance to make logic clear.
>
> - If current can't be migrated, useless to reschedule, let's hope
> task can move out.
> - If task is migratable, so let's not schedule it and see if it
> can be pushed or pulled somewhere else.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> kernel/sched/rt.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 87ea5bf..ca1b7c7 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1351,16 +1351,22 @@ out:
>
> static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
> {
> - if (rq->curr->nr_cpus_allowed == 1)
> + /*
> + * Current can't be migrated, useless to reschedule,
> + * let's hope p can move out.
> + */
> + if (rq->curr->nr_cpus_allowed == 1 ||
> + !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
> return;
>
> + /*
> + * p is migratable, so let's not schedule it and
> + * see if it is pushed or pulled somewhere else.
> + */
> if (p->nr_cpus_allowed != 1
> && cpupri_find(&rq->rd->cpupri, p, NULL))
> return;
>
> - if (!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
> - return;
> -
> /*
> * There appears to be other cpus that can accept
> * current and none to run 'p', so lets reschedule
^ permalink raw reply [flat|nested] 19+ messages in thread