Thread (35 messages) 35 messages, 10 authors, 2023-02-20

Re: [PATCH 3/9] sched: add sched_numa_find_nth_cpu()

From: Chen Yu <yu.c.chen@intel.com>
Date: 2023-02-03 00:59:14
Also in: linux-crypto, linux-rdma, lkml

On 2023-01-20 at 20:24:30 -0800, Yury Norov wrote:
The function finds Nth set CPU in a given cpumask starting from a given
node.

Leveraging the fact that each hop in sched_domains_numa_masks includes the
same or greater number of CPUs than the previous one, we can use binary
search on hops instead of linear walk, which makes the overall complexity
of O(log n) in terms of number of cpumask_weight() calls.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
Acked-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Peter Lafreniere <redacted>
---
 include/linux/topology.h |  8 ++++++
 kernel/sched/topology.c  | 57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
[snip] 
+ * sched_numa_find_nth_cpu() - given the NUMA topology, find the Nth next cpu
+ *                             closest to @cpu from @cpumask.
Just minor question, the @cpu below is used as the index, right? What does "close to @cpu"
mean above?
+ * cpumask: cpumask to find a cpu from
+ * cpu: Nth cpu to find
Maybe also add description for @node?

thanks,
Chenyu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help