[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230121042436.2661843-8-yury.norov@gmail.com>
Date: Fri, 20 Jan 2023 20:24:34 -0800
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Barry Song <baohua@...nel.org>,
Ben Segall <bsegall@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Gal Pressman <gal@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Haniel Bristot de Oliveira <bristot@...hat.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Ingo Molnar <mingo@...hat.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Jakub Kicinski <kuba@...nel.org>,
Jason Gunthorpe <jgg@...dia.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Juri Lelli <juri.lelli@...hat.com>,
Leon Romanovsky <leonro@...dia.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>,
Peter Lafreniere <peter@...jl.ca>,
Peter Zijlstra <peterz@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Saeed Mahameed <saeedm@...dia.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tariq Toukan <tariqt@...dia.com>,
Tariq Toukan <ttoukan.linux@...il.com>,
Tony Luck <tony.luck@...el.com>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>
Cc: Yury Norov <yury.norov@...il.com>, linux-crypto@...r.kernel.org,
netdev@...r.kernel.org, linux-rdma@...r.kernel.org
Subject: [PATCH 7/9] sched/topology: Introduce for_each_numa_hop_mask()
From: Valentin Schneider <vschneid@...hat.com>
The recently introduced sched_numa_hop_mask() exposes cpumasks of CPUs
reachable within a given distance budget, wrap the logic for iterating over
all (distance, mask) values inside an iterator macro.
Signed-off-by: Valentin Schneider <vschneid@...hat.com>
Reviewed-by: Yury Norov <yury.norov@...il.com>
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
include/linux/topology.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 344c2362755a..fea32377f7c7 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -261,4 +261,22 @@ sched_numa_hop_mask(unsigned int node, unsigned int hops)
}
#endif /* CONFIG_NUMA */
+/**
+ * for_each_numa_hop_mask - iterate over cpumasks of increasing NUMA distance
+ * from a given node.
+ * @mask: the iteration variable.
+ * @node: the NUMA node to start the search from.
+ *
+ * Requires rcu_lock to be held.
+ *
+ * Yields cpu_online_mask for @node == NUMA_NO_NODE.
+ */
+#define for_each_numa_hop_mask(mask, node) \
+ for (unsigned int __hops = 0; \
+ mask = (node != NUMA_NO_NODE || __hops) ? \
+ sched_numa_hop_mask(node, __hops) : \
+ cpu_online_mask, \
+ !IS_ERR_OR_NULL(mask); \
+ __hops++)
+
#endif /* _LINUX_TOPOLOGY_H */
--
2.34.1
Powered by blists - more mailing lists