[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180307113149.GA2211@e110439-lin>
Date: Wed, 7 Mar 2018 11:31:49 +0000
From: Patrick Bellasi <patrick.bellasi@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Paul Turner <pjt@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Morten Rasmussen <morten.rasmussen@....com>,
Juri Lelli <juri.lelli@...hat.com>,
Todd Kjos <tkjos@...roid.com>,
Joel Fernandes <joelaf@...gle.com>,
Steve Muckle <smuckle@...gle.com>
Subject: Re: [PATCH v5 1/4] sched/fair: add util_est on top of PELT
On 06-Mar 19:58, Peter Zijlstra wrote:
> On Thu, Feb 22, 2018 at 05:01:50PM +0000, Patrick Bellasi wrote:
> > +static inline void util_est_enqueue(struct cfs_rq *cfs_rq,
> > + struct task_struct *p)
> > +{
> > + unsigned int enqueued;
> > +
> > + if (!sched_feat(UTIL_EST))
> > + return;
> > +
> > + /* Update root cfs_rq's estimated utilization */
> > + enqueued = READ_ONCE(cfs_rq->avg.util_est.enqueued);
> > + enqueued += _task_util_est(p);
> > + WRITE_ONCE(cfs_rq->avg.util_est.enqueued, enqueued);
> > +}
>
> > +static inline void util_est_dequeue(struct cfs_rq *cfs_rq,
> > + struct task_struct *p,
> > + bool task_sleep)
> > +{
> > + long last_ewma_diff;
> > + struct util_est ue;
> > +
> > + if (!sched_feat(UTIL_EST))
> > + return;
> > +
> > + /*
> > + * Update root cfs_rq's estimated utilization
> > + *
> > + * If *p is the last task then the root cfs_rq's estimated utilization
> > + * of a CPU is 0 by definition.
> > + */
> > + ue.enqueued = 0;
> > + if (cfs_rq->nr_running) {
> > + ue.enqueued = READ_ONCE(cfs_rq->avg.util_est.enqueued);
> > + ue.enqueued -= min_t(unsigned int, ue.enqueued,
> > + _task_util_est(p));
> > + }
> > + WRITE_ONCE(cfs_rq->avg.util_est.enqueued, ue.enqueued);
>
> It appears to me this isn't a stable situation and completely relies on
> the !nr_running case to recalibrate. If we ensure that doesn't happen
> for a significant while the sum can run-away, right?
By away you mean go over 1024 or overflow the unsigned int storage?
In the first case, I think we don't care about exceeding 1024 since:
- we cap to capacity_orig_of in cpu_util_est
- by directly reading the cfs_rq->avg.util_est.enqueued we can
actually detect conditions in which a CPU is over-saturated.
In the second case, with an unsigned int we can enqueue up to few
millions of 100% tasks on a single CPU without overflowing.
> Should we put a max in enqueue to avoid this?
IMO the capping from the cpu_util_est getter should be enough...
Maybe I'm missing your point here?
--
#include <best/regards.h>
Patrick Bellasi
Powered by blists - more mailing lists