[PATCH] sched/deadline: fix artificial overrun introduced by yield_task_dl

From: Juri Lelli
Date: Wed Oct 29 2014 - 12:09:06 EST


Signed-off-by: Juri Lelli <juri.lelli@xxxxxxx>
---
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@xxxxxxxxxxxxxxx>
> ---
> 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);
> }
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/