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]
Date:   Mon, 3 May 2021 20:08:14 -0700
From:   Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...nel.org>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.comi>, Mel Gorman <mgorman@...e.de>,
        Len Brown <len.brown@...el.com>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Aubrey Li <aubrey.li@...ux.intel.com>,
        "Ravi V. Shankar" <ravi.v.shankar@...el.com>,
        Ricardo Neri <ricardo.neri@...el.com>,
        Quentin Perret <qperret@...gle.com>,
        "Joel Fernandes (Google)" <joel@...lfernandes.org>,
        linux-kernel@...r.kernel.org, Aubrey Li <aubrey.li@...el.com>,
        Ben Segall <bsegall@...gle.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH v2 1/4] sched/fair: Optimize checking for
 group_asym_packing

On Mon, May 03, 2021 at 11:24:25AM +0200, Peter Zijlstra wrote:
> On Tue, Apr 13, 2021 at 07:04:33PM -0700, Ricardo Neri wrote:
> > By checking local_group, we can avoid additional checks and invoking
> > sched_asmy_prefer() when it is not needed.
> 
> This really could do with a few words on *why* that is correct. ISTR
> thinking this made sense when I last looked at it, but today, after
> having the brain reset by not looking at a computer for 4 days its not
> immediate obvious anymore.

Thanks for your feedback Peter! I will add a comment explaining why this
is correct: when we are collecting statistics of the local group,
@env->dst_cpu belongs to @group. @env->dst_cpu may or may not be
@group->asym_prefer_cpu. If @env->dst_cpu, sched_asym_prefer() must return
false because it would be checking for

    arch_asym_cpu_priority(dst_cpu) >  arch_asym_cpu_priority(dst_cpu)

which is false. If @env->dst_cpu is not @group->env_prefer_cpu, it
implies that the former has lower prority than the latter and
sched_asym_prefer() will also return false.

Thanks and BR,
Ricardo

> 
> > Signed-off-by: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
> > ---
> >  kernel/sched/fair.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 04a3ce20da67..4ef3fa0d5e8d 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -8455,7 +8455,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
> >  	}
> >  
> >  	/* Check if dst CPU is idle and preferred to this group */
> > -	if (env->sd->flags & SD_ASYM_PACKING &&
> > +	if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
> >  	    env->idle != CPU_NOT_IDLE &&
> >  	    sgs->sum_h_nr_running &&
> >  	    sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
> > -- 
> > 2.17.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ