[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2KirAkaFX_R_GIJ@gpd3>
Date: Wed, 18 Dec 2024 11:23:40 +0100
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
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()
On Tue, Dec 17, 2024 at 11:57:44AM -1000, Tejun Heo wrote:
> 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.
I've also considered doing that. I don't know if it'd work with offline
nodes, but maybe we can just check node_online(node) at each iteration and
skip those that are not online.
-Andrea
Powered by blists - more mailing lists