lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtBB3jyOWrv8=+S2zRXD+pSXPWgoZ3aJUscE5yJDpkDmzw@mail.gmail.com>
Date:	Mon, 20 Jun 2016 14:35:30 +0200
From:	Vincent Guittot <vincent.guittot@...aro.org>
To:	Dietmar Eggemann <dietmar.eggemann@....com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	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>,
	Matt Fleming <matt@...eblueprint.co.uk>
Subject: Re: [PATCH 4/4] sched,fair: Fix PELT integrity for new tasks

On 20 June 2016 at 13:35, Dietmar Eggemann <dietmar.eggemann@....com> wrote:
>
>
> On 17/06/16 17:18, Peter Zijlstra wrote:
>> On Fri, Jun 17, 2016 at 06:02:39PM +0200, Peter Zijlstra wrote:
>>> So yes, ho-humm, how to go about doing that bestest. Lemme have a play.
>>
>> This is what I came up with, not entirely pretty, but I suppose it'll
>> have to do.
>>
>> ---
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -724,6 +724,7 @@ void post_init_entity_util_avg(struct sc
>>       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) {
>> @@ -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)) {
>> +             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);
>>  }
>>
>>
>
> Doesn't a sleeping !fair_sched_class task which switches to fair uses
> try_to_wake_up() rather than wake_up_new_task() so it won't go through
> post_init_entity_util_avg()?

It will go through wake_up_new_task and post_init_entity_util_avg
during its fork which is enough to set last_update_time. Then, it will
use the switched_to_fair if the task becomes a fair one

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ