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: <20200212161103.GX3420@suse.de>
Date:   Wed, 12 Feb 2020 16:11:03 +0000
From:   Mel Gorman <mgorman@...e.de>
To:     Vincent Guittot <vincent.guittot@...aro.org>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Phil Auld <pauld@...hat.com>, Parth Shah <parth@...ux.ibm.com>,
        Valentin Schneider <valentin.schneider@....com>
Subject: Re: [PATCH 1/4] sched/fair: reorder enqueue/dequeue_task_fair path

On Wed, Feb 12, 2020 at 03:47:30PM +0100, Vincent Guittot wrote:
> > I'm having trouble reconciling the patch with the description and the
> > comments explaining the intent behind the code are unhelpful.
> >
> > There are two loops before and after your patch -- the first dealing with
> > sched entities that are not on a runqueue and the second for the remaining
> > entities that are. The intent appears to be to update the load averages
> > once the entity is active on a runqueue.
> >
> > I'm not getting why the changelog says everything related to cfs is
> > now done in one loop because there are still two. But even if you do
> > get throttled, it's not clear why you jump to the !se check given that
> > for_each_sched_entity did not complete. What it *does* appear to do is
> > have all the h_nr_running related to entities being enqueued updated in
> > one loop and all remaining entities stats updated in the other.
> 
> Let's take the example of 2 levels in addition to root so we have :
> root->cfs1->cfs2
> Now we enqueue a task T1 on cfs2 but cfs1 is throttled, we will have
> the sequence:
> 
> In 1st for_each_sched_entity loop:
>   loop 1
>     enqueue_entity (T1->se, cfs2) which calls update load_avg(cfs2)
>     cfs2->h_nr_running++;
>   loop 2
>     enqueue_entity (cfs2->gse, cfs1) which calls update load_avg(cfs1)
>     break because cfs1 is throttled
> 
> In 2nd for_each_sched_entity loop:
>   loop 1
>     cfs1->h_nr_running++
>     break because throttled
> 
> Using the 2nd loop for incrementing h_nr_running of the throttled cfs
> is useless and we could do that directly in 1st loop and skip the 2nd
> loop
> 
> With this patch we have :
> 
> In 1st for_each_sched_entity loop:
>   loop 1
>     enqueue_entity (T1->se, cfs2) which update load_avg(cfs2)
>     cfs2->h_nr_running++;
>   loop 2
>     enqueue_entity (cfs2->gse, cfs1) which update load_avg(cfs1)
>     cfs1->h_nr_running++
>     skip the 2nd for_each_sched_entity entirely
> 
> Then the patch also reorders the call to update_load_avg() and the
> increment of h_nr_running
> 
> Before the patch we had different order between the to
> for_each_sched_entity which is not a problem because there is
> currently no relation between both. But the following patches make
> PELT using h_nr_running so we must have the same ordering to prevent
> updating pelt with the wrong h_nr_running value
> 

Ok, understood. Thanks for clearing that up!

-- 
Mel Gorman
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ