Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1371525 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2016-04-05 14:50 +0200 |
| Last post | 2016-04-05 19:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC v2 3/7] Improve the tracking of active utilisation Peter Zijlstra <peterz@infradead.org> - 2016-04-05 14:50 +0200
Re: [RFC v2 3/7] Improve the tracking of active utilisation luca abeni <luca.abeni@unitn.it> - 2016-04-05 19:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-04-05 14:50 +0200 |
| Subject | Re: [RFC v2 3/7] Improve the tracking of active utilisation |
| Message-ID | <rkyAI-3wP-45@gated-at.bofh.it> |
On Fri, Apr 01, 2016 at 05:12:29PM +0200, Luca Abeni wrote:
> +static void task_go_inactive(struct task_struct *p)
> +{
> + struct sched_dl_entity *dl_se = &p->dl;
> + struct hrtimer *timer = &dl_se->inactive_timer;
> + struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> + struct rq *rq = rq_of_dl_rq(dl_rq);
> + ktime_t now, act;
> + s64 delta;
> + u64 zerolag_time;
s64 zerolag_time;
> +
> + WARN_ON(dl_se->dl_runtime == 0);
> +
> + /* If the inactive timer is already armed, return immediately */
> + if (hrtimer_active(&dl_se->inactive_timer))
> + return;
> +
> +
> + /*
> + * We want the timer to fire at the "0 lag time", but considering
> + * that it is actually coming from rq->clock and not from
> + * hrtimer's time base reading.
> + */
> + zerolag_time = dl_se->deadline -
> + div64_long((dl_se->runtime * dl_se->dl_period),
> + dl_se->dl_runtime);
> +
> + act = ns_to_ktime(zerolag_time);
> + now = hrtimer_cb_get_time(timer);
> + delta = ktime_to_ns(now) - rq_clock(rq);
> + act = ktime_add_ns(act, delta);
Would something like:
zerolag_time -= rq_clock(rq);
> +
> + /*
> + * If the "0-lag time" already passed, decrease the active
> + * utilization now, instead of starting a timer
> + */
> + if (ktime_us_delta(act, now) < 0) {
if (zerolag_time < 0)
> + sub_running_bw(dl_se, dl_rq);
> + if (!dl_task(p))
> + __dl_clear_params(p);
> +
> + return;
> + }
> +
> + get_task_struct(p);
> + hrtimer_start(timer, act, HRTIMER_MODE_ABS);
hrtimer_start(timer, ns_to_ktime(zerolag), HRTIMER_MODE_REL);
> +}
Not be simpler ?
[toc] | [next] | [standalone]
| From | luca abeni <luca.abeni@unitn.it> |
|---|---|
| Date | 2016-04-05 19:10 +0200 |
| Message-ID | <rkCEj-7qs-19@gated-at.bofh.it> |
| In reply to | #1371525 |
Hi Peter,
On Tue, 5 Apr 2016 14:42:18 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, Apr 01, 2016 at 05:12:29PM +0200, Luca Abeni wrote:
> > +static void task_go_inactive(struct task_struct *p)
> > +{
> > + struct sched_dl_entity *dl_se = &p->dl;
> > + struct hrtimer *timer = &dl_se->inactive_timer;
> > + struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> > + struct rq *rq = rq_of_dl_rq(dl_rq);
> > + ktime_t now, act;
> > + s64 delta;
> > + u64 zerolag_time;
>
> s64 zerolag_time;
Ok.
[...]
> Would something like:
>
> zerolag_time -= rq_clock(rq);
>
> > +
> > + /*
> > + * If the "0-lag time" already passed, decrease the active
> > + * utilization now, instead of starting a timer
> > + */
> > + if (ktime_us_delta(act, now) < 0) {
>
> if (zerolag_time < 0)
>
> > + sub_running_bw(dl_se, dl_rq);
> > + if (!dl_task(p))
> > + __dl_clear_params(p);
> > +
> > + return;
> > + }
> > +
> > + get_task_struct(p);
> > + hrtimer_start(timer, act, HRTIMER_MODE_ABS);
>
> hrtimer_start(timer, ns_to_ktime(zerolag), HRTIMER_MODE_REL);
>
> > +}
>
> Not be simpler ?
I think I blindly copied this code from the deadline timer, but yes,
you are right, I am doing a lot of useless conversions here. I'll fix
this.
Thanks,
Luca
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web