[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZEi7n4ZJgF2o8Ps9@yury-ThinkPad>
Date: Tue, 25 Apr 2023 22:50:23 -0700
From: Yury Norov <yury.norov@...il.com>
To: Valentin Schneider <vschneid@...hat.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
Saeed Mahameed <saeedm@...dia.com>,
Pawel Chmielewski <pawel.chmielewski@...el.com>,
Leon Romanovsky <leon@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.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.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Tariq Toukan <tariqt@...dia.com>,
Gal Pressman <gal@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heiko Carstens <hca@...ux.ibm.com>,
Barry Song <baohua@...nel.org>
Subject: Re: [PATCH v2 7/8] lib: add test for for_each_numa_{cpu,hop_mask}()
Hi Valentin,
Thanks for review!
On Mon, Apr 24, 2023 at 06:09:52PM +0100, Valentin Schneider wrote:
> On 19/04/23 22:19, Yury Norov wrote:
> > + for (node = 0; node < sched_domains_numa_levels; node++) {
> > + unsigned int hop, c = 0;
> > +
> > + rcu_read_lock();
> > + for_each_numa_cpu(cpu, hop, node, cpu_online_mask)
> > + expect_eq_uint(cpumask_local_spread(c++, node), cpu);
> > + rcu_read_unlock();
> > + }
>
> I'm not fond of the export of sched_domains_numa_levels, especially
> considering it's just there for tests.
>
> Furthermore, is there any value is testing parity with
> cpumask_local_spread()?
I wanted to emphasize that new NUMA-aware functions are coherent with
each other, just like find_nth_bit() is coherent with find_next_bit().
But all that coherence looks important only in non-NUMA case, because
client code may depend on fact that next CPU is never less than current.
This doesn't hold for NUMA iterators anyways...
> Rather, shouldn't we check that using this API does
> yield CPUs of increasing NUMA distance?
>
> Something like
>
> for_each_node(node) {
> unsigned int prev_cpu, hop = 0;
>
> cpu = cpumask_first(cpumask_of_node(node));
> prev_cpu = cpu;
>
> rcu_read_lock();
>
> /* Assert distance is monotonically increasing */
> for_each_numa_cpu(cpu, hop, node, cpu_online_mask) {
> expect_ge_uint(cpu_to_node(cpu), cpu_to_node(prev_cpu));
> prev_cpu = cpu;
> }
>
> rcu_read_unlock();
> }
Your version of the test looks more straightforward. I need to think
for more, but it looks like I can take it in v3.
Thanks,
Yury
Powered by blists - more mailing lists