From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Valentin Schneider <vschneid@redhat.com>,
Tariq Toukan <tariqt@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Saeed Mahameed <saeedm@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>
Cc: Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Gal Pressman <gal@nvidia.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next V4 1/3] sched/topology: Add NUMA-based CPUs spread API
Date: Tue, 9 Aug 2022 17:04:07 +0300 [thread overview]
Message-ID: <69829c71-d51c-b25f-2d74-5fdd231ed9e4@gmail.com> (raw)
In-Reply-To: <xhsmhzggdbmv6.mognet@vschneid.remote.csb>
On 8/9/2022 3:52 PM, Valentin Schneider wrote:
> On 09/08/22 13:18, Tariq Toukan wrote:
>> On 8/9/2022 1:02 PM, Valentin Schneider wrote:
>>>
>>> Are there cases where we can't figure this out in advance? From what I grok
>>> out of the two callsites you patched, all vectors will be used unless some
>>> error happens, so compressing the CPUs in a single cpumask seemed
>>> sufficient.
>>>
>>
>> All vectors will be initialized to support the maximum number of traffic
>> rings. However, the actual number of traffic rings can be controlled and
>> set to a lower number N_actual < N. In this case, we'll be using only
>> N_actual instances and we want them to be the first/closest.
>
> Ok, that makes sense, thank you.
>
> In that case I wonder if we'd want a public-facing iterator for
> sched_domains_numa_masks[%i][node], rather than copy a portion of
> it. Something like the below (naming and implementation haven't been
> thought about too much).
>
> const struct cpumask *sched_numa_level_mask(int node, int level)
> {
> struct cpumask ***masks = rcu_dereference(sched_domains_numa_masks);
>
> if (node >= nr_node_ids || level >= sched_domains_numa_levels)
> return NULL;
>
> if (!masks)
> return NULL;
>
> return masks[level][node];
> }
> EXPORT_SYMBOL_GPL(sched_numa_level_mask);
>
The above can be kept static, and expose only the foo() function below,
similar to my sched_cpus_set_spread().
LGTM.
How do you suggest to proceed?
You want to formalize it? Or should I take it from here?
> #define for_each_numa_level_mask(node, lvl, mask) \
> for (mask = sched_numa_level_mask(node, lvl); mask; \
> mask = sched_numa_level_mask(node, ++lvl))
>
> void foo(int node, int cpus[], int ncpus)
> {
> const struct cpumask *mask;
> int lvl = 0;
> int i = 0;
> int cpu;
>
> rcu_read_lock();
> for_each_numa_level_mask(node, lvl, mask) {
> for_each_cpu(cpu, mask) {
> cpus[i] = cpu;
> if (++i == ncpus)
> goto done;
> }
> }
> done:
> rcu_read_unlock();
> }
>
next prev parent reply other threads:[~2022-08-09 14:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 19:12 [PATCH net-next V4 0/3] Introduce and use NUMA distance metrics Tariq Toukan
2022-07-28 19:12 ` [PATCH net-next V4 1/3] sched/topology: Add NUMA-based CPUs spread API Tariq Toukan
2022-07-30 17:29 ` Tariq Toukan
2022-08-02 6:40 ` Tariq Toukan
2022-08-02 9:38 ` Valentin Schneider
2022-08-02 16:05 ` Jakub Kicinski
2022-08-04 17:28 ` Valentin Schneider
2022-08-08 14:39 ` Tariq Toukan
2022-08-09 10:02 ` Valentin Schneider
2022-08-09 10:18 ` Tariq Toukan
2022-08-09 12:52 ` Valentin Schneider
2022-08-09 14:04 ` Tariq Toukan [this message]
2022-08-09 17:36 ` Valentin Schneider
2022-08-10 10:46 ` Valentin Schneider
2022-08-10 10:51 ` [PATCH 1/2] sched/topology: Introduce sched_numa_hop_mask() Valentin Schneider
2022-08-10 10:51 ` [PATCH 2/2] net/mlx5e: Leverage sched_numa_hop_mask() Valentin Schneider
2022-08-10 12:57 ` Tariq Toukan
2022-08-10 17:42 ` Jakub Kicinski
2022-08-11 14:26 ` Valentin Schneider
2022-08-10 12:42 ` [PATCH 1/2] sched/topology: Introduce sched_numa_hop_mask() Tariq Toukan
2022-08-10 12:57 ` Tariq Toukan
2022-08-11 14:26 ` Valentin Schneider
2022-08-14 8:19 ` Tariq Toukan
2022-08-14 8:26 ` Tariq Toukan
2022-08-15 14:20 ` Valentin Schneider
2022-07-28 19:12 ` [PATCH net-next V4 2/3] net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints Tariq Toukan
2022-07-28 19:12 ` [PATCH net-next V4 3/3] enic: Use NUMA distances logic when setting " Tariq Toukan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69829c71-d51c-b25f-2d74-5fdd231ed9e4@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=juri.lelli@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome