2010-11-10 20:21:34

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [RFC][PATCH 05/22] sched: SCHED_DEADLINE policy implementation

On Fri, 2010-10-29 at 08:30 +0200, Raistlin wrote:
> +static void update_dl_entity(struct sched_dl_entity *dl_se)
> +{
> + struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> + struct rq *rq = rq_of_dl_rq(dl_rq);
> +
> + /*
> + * The arrival of a new instance needs special treatment, i.e.,
> + * the actual scheduling parameters have to be "renewed".
> + */
> + if (dl_se->dl_new) {
> + setup_new_dl_entity(dl_se);
> + return;
> + }
> +
> + if (dl_time_before(dl_se->deadline, rq->clock) ||
> + dl_entity_overflow(dl_se, rq->clock)) {
> + dl_se->deadline = rq->clock + dl_se->dl_deadline;
> + dl_se->runtime = dl_se->dl_runtime;
> + }
> +}

Can't we loose runtime deficit this way?


2010-11-11 01:19:10

by Dario Faggioli

[permalink] [raw]
Subject: Re: [RFC][PATCH 05/22] sched: SCHED_DEADLINE policy implementation

On Wed, 2010-11-10 at 21:21 +0100, Peter Zijlstra wrote:
> > + if (dl_time_before(dl_se->deadline, rq->clock) ||
> > + dl_entity_overflow(dl_se, rq->clock)) {
> > + dl_se->deadline = rq->clock + dl_se->dl_deadline;
> > + dl_se->runtime = dl_se->dl_runtime;
> > + }
> > +}
>
> Can't we loose runtime deficit this way?
>
No, this should not be the case (I hope!). The rationale is basically
the same of the other e-mail about new instances.

In fact, a task that goes to sleep with some available runtime will be
given new parameters or not, depending on the return value of
dl_entity_overflow, and that's fine, right?

On the other hand, a task blocking while in overrun will (at dequeue_*
and/or put_* time) trigger the bandwidth enforcement logic (which arms
dl_timer) so that:
- if unblocking happens _before_ it becomes eligible again, the
enqueue will be later handled by the dl_timer itself, when it'll
fire, and the task will be given a replenishment starting from its
negative runtime;
- if unblocking happens _later_ than the firing of dl_timer, resetting
the scheduling parameters should be just fine, from the bandwidth
point of view.

Does it make sense?

Regards,
Dario

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)

http://blog.linux.it/raistlin / [email protected] /
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part

2010-11-11 13:13:46

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [RFC][PATCH 05/22] sched: SCHED_DEADLINE policy implementation

On Thu, 2010-11-11 at 02:18 +0100, Raistlin wrote:
> On Wed, 2010-11-10 at 21:21 +0100, Peter Zijlstra wrote:
> > > + if (dl_time_before(dl_se->deadline, rq->clock) ||
> > > + dl_entity_overflow(dl_se, rq->clock)) {
> > > + dl_se->deadline = rq->clock + dl_se->dl_deadline;
> > > + dl_se->runtime = dl_se->dl_runtime;
> > > + }
> > > +}
> >
> > Can't we loose runtime deficit this way?

> - if unblocking happens _before_ it becomes eligible again, the
> enqueue will be later handled by the dl_timer itself, when it'll
> fire, and the task will be given a replenishment starting from its
> negative runtime;
> - if unblocking happens _later_ than the firing of dl_timer, resetting
> the scheduling parameters should be just fine, from the bandwidth
> point of view.
>
> Does it make sense?

Yes, I think so. Thanks!