Re: [PATCH] [sched] Don't account time after deadline twice

From: Juri Lelli
Date: Thu Jul 03 2014 - 05:50:50 EST


On Wed, 2 Jul 2014 19:44:04 -0400
Zhihui Zhang <zzhsuny@xxxxxxxxx> wrote:

> My point is that rq_clock(rq) - dl_se->deadline is already part of
> dl_se->runtime, which is decremented before calling dl_runtime_exceeded().

But, we decrement dl_se->runtime looking at rq_clock_task(rq), that is
in general <= rq_clock(rq), that we use to handle deadlines. So, if we
do like you suggest, in some cases we could end up stealing some
bandwidth from the system. Indeed, we prefer some pessimism here.

Thanks,

- Juri

> So the following line is not needed in the case of both overrun and missing
> deadline:
>
> dl_se->runtime -= rq_clock(rq) - dl_se->deadline;
>
> Or did I miss anything?
>
> thanks,
>
>
> On Tue, Jul 1, 2014 at 9:59 AM, Juri Lelli <juri.lelli@xxxxxxxxx> wrote:
>
> > On Tue, 1 Jul 2014 15:08:16 +0200
> > Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > > On Sun, Jun 29, 2014 at 09:26:10PM -0400, Zhihui Zhang wrote:
> > > > Unless we want to double-penalize an overrun task, the time after the
> > deadline
> > > > and before the current time is already accounted in the negative
> > dl_se->runtime
> > > > value. So we can leave it as is in the case of dmiss && rorun.
> > >
> > > Juri?
> > >
> > > > Signed-off-by: Zhihui Zhang <zzhsuny@xxxxxxxxx>
> > > > ---
> > > > kernel/sched/deadline.c | 6 ++----
> > > > 1 file changed, 2 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > > > index fc4f98b1..67df0d6 100644
> > > > --- a/kernel/sched/deadline.c
> > > > +++ b/kernel/sched/deadline.c
> > > > @@ -579,10 +579,8 @@ int dl_runtime_exceeded(struct rq *rq, struct
> > sched_dl_entity *dl_se)
> > > > * the next instance. Thus, if we do not account that, we are
> > > > * stealing bandwidth from the system at each deadline miss!
> > > > */
> > > > - if (dmiss) {
> > > > - dl_se->runtime = rorun ? dl_se->runtime : 0;
> >
> > If we didn't return 0 before, we are going to throttle (or replenish)
> > the entity, and you want runtime to be <=0. So, this is needed.
> >
> > > > - dl_se->runtime -= rq_clock(rq) - dl_se->deadline;
> > > > - }
> >
> > A little pessimism in some cases, due to the fact that we use both
> > rq_clock and rq_clock_task (for the budget).
> >
> > Thanks,
> >
> > - Juri
> >
> > > > + if (dmiss && !rorun)
> > > > + dl_se->runtime = dl_se->deadline - rq_clock(rq);
> > > >
> > > > return 1;
> > > > }
> > > > --
> > > > 1.8.1.2
> > > >
> >
--
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/