[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2Hz2NW-J06BuuHj@slm.duckdns.org>
Date: Tue, 17 Dec 2024 11:57:44 -1000
From: Tejun Heo <tj@...nel.org>
To: Andrea Righi <arighi@...dia.com>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
Yury Norov <yury.norov@...il.com>, 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>,
Valentin Schneider <vschneid@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] sched/topology: introduce for_each_numa_hop_node() /
sched_numa_hop_node()
Hello,
On Tue, Dec 17, 2024 at 10:32:26AM +0100, Andrea Righi wrote:
...
> +int sched_numa_hop_node(nodemask_t *hop_nodes, int start, unsigned int state)
> +{
> + int dist, n, min_node, min_dist;
> +
> + if (state >= NR_NODE_STATES)
> + return NUMA_NO_NODE;
> +
> + min_node = NUMA_NO_NODE;
> + min_dist = INT_MAX;
> +
> + for_each_node_state(n, state) {
> + if (n == start || node_isset(n, *hop_nodes))
> + continue;
> + dist = node_distance(start, n);
> + if (dist < min_dist) {
> + min_dist = dist;
> + min_node = n;
> + }
> + }
> + if (min_node != NUMA_NO_NODE)
> + node_set(min_node, *hop_nodes);
> +
> + return min_node;
> +}
So, this would work but given that there is nothing dynamic about this
ordering, would it make more sense to build the ordering and store it
per-node? Then, the iteration just becomes walking that array.
Thanks.
--
tejun
Powered by blists - more mailing lists