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:   Fri, 10 Jun 2022 16:42:05 +0200
From:   Vincent Guittot <vincent.guittot@...aro.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Valentin Schneider <vschneid@...hat.com>,
        K Prateek Nayak <kprateek.nayak@....com>,
        aubrey.li@...ux.intel.com, efault@....de, gautham.shenoy@....com,
        linux-kernel@...r.kernel.org, mgorman@...hsingularity.net,
        mingo@...nel.org, song.bao.hua@...ilicon.com,
        srikar@...ux.vnet.ibm.com, valentin.schneider@....com
Subject: Re: [PATCH v7] sched/fair: Consider cpu affinity when allowing NUMA
 imbalance in find_idlest_group

On Fri, 10 Jun 2022 at 16:15, Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Fri, Jun 10, 2022 at 11:55:37AM +0100, Valentin Schneider wrote:
> > On 09/06/22 13:54, Peter Zijlstra wrote:
> > > Now, I can (and have) fixed up the conflict, but it did make me look at
> > > this in a little more detail; and the thing I noticed is that your:
> > >
> > >   'p->nr_cpus_allowed != num_online_cpus()'
> > >
> > > test makes no sense. That's basically 'true'. The thing is,
> > > nr_cpus_allowed is initialized to NR_CPUS, and unless someone somewhere
> > > did set_cpus_allowed() on it, it'll still be NR_CPUS.
> > >
> > > Also, CPU hotplug doesn't change nr_cpus_allowed, so num_online_cpus()
> > > is just plain wrong.
> > >
> > > Now, something that might work is:
> > >
> > >   'p->nr_cpus_allowed < num_online_cpus()'
> > >
> > > And even that is no guarantee. You can construct a situation where this
> > > is still false even though you actually have a constrained set.
> > > Consider a machine with 8 CPUs. Then set the mask to: 0x55, which has 4
> > > CPUs set. Then offline the last 4 so that the online mask becomes 0x0f.
> > >
> > > Then the effective mask is 0x05, and the number we're looking for above
> > > is 2, but the suggested test would still be false, because
> > > nr_cpus_allowed would be 4, as would num_online_cpus().
> > >
> >
> > IIUC we want to pay special attention when the task isn't allowed to run on
> > all online CPUs, wouldn't the below do that?
> >
> >   !cpumask_subset(cpu_online_mask, p->cpus_ptr)
>
> At that point we might just as well do the whole cpumask_and() thing,
> no? There's not much cost difference between these two operations.

The test was there to not do the computation with cpumask_and() if the
task's affinity has not been modified so maybe it would be enough to
test (p->nr_cpus_allowed != NR_CPUS) to check if the task's affinity
has been modified and we have we do the cpumask_and()  and
cpumask_weight()

>
> > The task affinity can be a superset of the online mask, obvious case is
> > init_task's CPU_MASK_ALL, and the above test is still false if both masks
> > are equal.
> >
> > (Additionnaly we could add a step in sched_init() to "properly" initialize
> > the init_task mask and remove the NR_CPUS faff).
>
> I'm confused, NR_CPUS is the right value for CPU_MASK_ALL.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ