[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtAC5VKsUR9EUYP_kigvmc+UNkca9EqOb4erUm2r9NSAig@mail.gmail.com>
Date: Mon, 20 Jun 2016 12:07:04 +0200
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Yuyang Du <yuyang.du@...el.com>, Ingo Molnar <mingo@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Mike Galbraith <umgwanakikbuti@...il.com>,
Benjamin Segall <bsegall@...gle.com>,
Paul Turner <pjt@...gle.com>,
Morten Rasmussen <morten.rasmussen@....com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Matt Fleming <matt@...eblueprint.co.uk>
Subject: Re: [PATCH 4/4] sched,fair: Fix PELT integrity for new tasks
On 20 June 2016 at 11:52, Peter Zijlstra <peterz@...radead.org> wrote:
> On Mon, Jun 20, 2016 at 11:23:39AM +0200, Vincent Guittot wrote:
>
>> > @@ -738,7 +739,20 @@ void post_init_entity_util_avg(struct sc
>> > sa->util_sum = sa->util_avg * LOAD_AVG_MAX;
>> > }
>> >
>> > - update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, false);
>> > + if (entity_is_task(se)) {
>>
>> Why only task ?
>
> Only tasks can be of another class, the cgroup se's must be fair.
ok
>
>> > + struct task_struct *p = task_of(se);
>> > + if (p->sched_class != &fair_sched_class) {
>> > + /*
>> > + * For !fair tasks do attach_entity_load_avg()
>> > + * followed by detach_entity_load_avg() as per
>> > + * switched_from_fair().
>> > + */
>> > + se->avg.last_update_time = now;
>> > + return;
>> > + }
>> > + }
>> > +
>> > + update_cfs_rq_load_avg(now, cfs_rq, false);
>> > attach_entity_load_avg(cfs_rq, se);
>>
>> Don't we have to do a complete attach with attach_task_cfs_rq instead
>> of just the load_avg ? to set also depth ?
>
> init_tg_cfs_entity() sets depth for cgroup entities,
> attach_task_cfs_rq() reset depth on switched_to().
>
> So that should be fine.
But for new fair task ? it will not be set
>
>> ---
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -723,6 +723,7 @@ void post_init_entity_util_avg(struct sched_entity *se)
>> struct cfs_rq *cfs_rq = cfs_rq_of(se);
>> struct sched_avg *sa = &se->avg;
>> long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2;
>> + u64 now = cfs_rq_clock_task(cfs_rq);
>>
>> if (cap > 0) {
>> if (cfs_rq->avg.util_avg != 0) {
>> @@ -737,8 +738,18 @@ void post_init_entity_util_avg(struct sched_entity *se)
>> sa->util_sum = sa->util_avg * LOAD_AVG_MAX;
>> }
>>
>> - update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, false);
>> - attach_entity_load_avg(cfs_rq, se);
>
> There is no p here...
yes my condition is just wrong
>
>> + if (p->sched_class == &fair_sched_class) {
>> + /* fair entity must be attached to cfs_rq */
>> + attach_task_cfs_rq(se);
>> + } else {
>> + /*
>> + * For !fair tasks do attach_entity_load_avg()
>> + * followed by detach_entity_load_avg() as per
>> + * switched_from_fair().
>> + */
>> + se->avg.last_update_time = now;
>> + }
>> +
>> }
>
> And you're now not attaching new cgroup thingies.
Powered by blists - more mailing lists