[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABk29NskBLS+s2J-FjzdmnrxvKR_+zQ1GxGkgiui=A1b-fvXtQ@mail.gmail.com>
Date: Mon, 20 Apr 2020 14:36:49 -0700
From: Josh Don <joshdon@...gle.com>
To: Qais Yousef <qais.yousef@....com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Yury Norov <yury.norov@...il.com>,
Paul Turner <pjt@...gle.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Pavan Kondeti <pkondeti@...eaurora.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] cpumask: Make cpumask_any() truly random
On Mon, Apr 20, 2020 at 8:43 AM Qais Yousef <qais.yousef@....com> wrote:
>
> On 04/15/20 11:36, Peter Zijlstra wrote:
> > On Tue, Apr 14, 2020 at 12:19:56PM -0400, Steven Rostedt wrote:
> > > Do we care if this gets preempted and migrated to a new CPU where we read
> > > "prev" from one distribute_cpu_mask_prev on one CPU and write it to another
> > > CPU?
> >
> > I don't think we do; that just adds to the randomness ;-), but you do
>
> Yep we don't care and it should enhance the randomness.
>
> > raise a good point in that __this_cpu_*() ops assume preemption is
> > already disabled, which is true of the one exiting
> > cpumask_any_and_distribute() caller, but is no longer true after patch
> > 1, and this patch repeats the mistake.
> >
> > So either we need to disable preemption across the function or
> > transition to this_cpu_*() ops.
>
> Sorry wasn't aware about the preemption check in __this_cpu_write().
>
> Transitioning to this_cpu_write() makes sense. Unless Josh comes back it'll
> break something he noticed.
Yep, this_cpu_* makes sense to me. Preemption is ok, since prev must
always be a valid cpu id, thus we just get a little more _random_ from
this pseudorandom implementation.
Powered by blists - more mailing lists