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: <CABk29Ns8C6iQJHkJNAhNOm2=CVjApicK5Y5teUSMjb2ncEx4_w@mail.gmail.com>
Date:   Tue, 28 Jun 2022 17:41:06 -0700
From:   Josh Don <joshdon@...gle.com>
To:     Abel Wu <wuyun.abel@...edance.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Mel Gorman <mgorman@...e.de>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Chen Yu <yu.c.chen@...el.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        K Prateek Nayak <kprateek.nayak@....com>,
        "Gautham R . Shenoy" <gautham.shenoy@....com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 4/7] sched/fair: remove useless check in select_idle_core

On Mon, Jun 27, 2022 at 8:51 PM Abel Wu <wuyun.abel@...edance.com> wrote:
>
>
> On 6/28/22 7:42 AM, Josh Don Wrote:
> > On Sun, Jun 19, 2022 at 5:05 AM Abel Wu <wuyun.abel@...edance.com> wrote:
> >>
> >> The function only gets called when sds->has_idle_cores is true which can
> >> be possible only when sched_smt_present is enabled.
> >>
> >> Signed-off-by: Abel Wu <wuyun.abel@...edance.com>
> >> ---
> >>   kernel/sched/fair.c | 3 ---
> >>   1 file changed, 3 deletions(-)
> >>
> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >> index aba1dad19574..1cc86e76e38e 100644
> >> --- a/kernel/sched/fair.c
> >> +++ b/kernel/sched/fair.c
> >> @@ -6256,9 +6256,6 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu
> >>          bool idle = true;
> >>          int cpu;
> >>
> >> -       if (!static_branch_likely(&sched_smt_present))
> >> -               return __select_idle_cpu(core, p);
> >> -
> >
> > The static branch is basically free; although you're right that we
> > currently don't take !smt_present branch direction here, it doesn't
> > seem harmful to leave this check in case assumptions change about when
> > we call select_idle_core().
>
> I was thinking that it would be better to align with select_idle_smt
> that the caller do the check if necessary.

The difference there though is that select_idle_smt() is called
directly under the sched_smt_active() check, whereas the
select_idle_core() is a few nested function calls away (and relies on
has_idle_core rather than sched_smt_active() directly). So it is a bit
harder to codify this expectation. Since we're using a static_branch
here, I don't see a strong reason to remove it.

> >
> >>          for_each_cpu(cpu, cpu_smt_mask(core)) {
> >>                  if (!available_idle_cpu(cpu)) {
> >>                          idle = false;
> >> --
> >> 2.31.1
> >>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ