Re: [RFC v5 1/9] sched/deadline: track the active utilization

From: luca abeni
Date: Sun Mar 26 2017 - 16:56:37 EST


Hi Mathieu,

On Sun, 26 Mar 2017 11:04:18 -0600
Mathieu Poirier <mathieu.poirier@xxxxxxxxxx> wrote:

[...]
> > @@ -946,8 +968,12 @@ enqueue_dl_entity(struct sched_dl_entity
> > *dl_se,
> > * parameters of the task might need updating. Otherwise,
> > * we want a replenishment of its runtime.
> > */
> > - if (flags & ENQUEUE_WAKEUP)
> > + if (flags & ENQUEUE_WAKEUP) {
> > + struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> > +
> > + add_running_bw(dl_se->dl_bw, dl_rq);
> > update_dl_entity(dl_se, pi_se);
> > + }
>
> What do we do for tasks that go from normal to dl? Unless I'm
> mistaking their utilisation won't be accounted for when they are first
> enqueued.

This case should be handled by the "if (flags & ENQUEUE_WAKEUP)" branch
in enqueue_dl_entity().

[...]
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index 57caf36..caaa7d3 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -558,6 +558,12 @@ struct dl_rq {
> > #else
> > struct dl_bw dl_bw;
> > #endif
> > + /*
> > + * "Active utilization" for this runqueue: increased when a
> > + * task wakes up (becomes TASK_RUNNING) and decreased when a
> > + * task blocks
> > + */
> > + u64 running_bw;
>
> Would it be a good idea to initialise and clear this field in
> rq_online/offline_dl()?

Thanks for pointing this out... I have to admit I do not know the
online/offline code too much (and I am not sure if I am handling this
correctly).
I'll try to have a look on Monday.


Thanks,
Luca