Commit 4fcbe96e authored by Dan Williams's avatar Dan Williams

mm/numa: Skip NUMA_NO_NODE and online nodes in numa_map_to_online_node()

Update numa_map_to_online_node() to stop falling back to numa node 0
when the input is NUMA_NO_NODE. Also, skip the lookup if @node is
online. This makes the routine compatible with other arch node mapping
routines.
Reported-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Link: https://lore.kernel.org/r/157401275716.43284.13185549705765009174.stgit@dwillia2-desk3.amr.corp.intel.comReviewed-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/158188325316.894464.15650888748083329531.stgit@dwillia2-desk3.amr.corp.intel.com
parent b2ca916c
...@@ -135,15 +135,12 @@ static struct mempolicy preferred_node_policy[MAX_NUMNODES]; ...@@ -135,15 +135,12 @@ static struct mempolicy preferred_node_policy[MAX_NUMNODES];
*/ */
int numa_map_to_online_node(int node) int numa_map_to_online_node(int node)
{ {
int min_node; int min_dist = INT_MAX, dist, n, min_node;
if (node == NUMA_NO_NODE) if (node == NUMA_NO_NODE || node_online(node))
node = 0; return node;
min_node = node; min_node = node;
if (!node_online(node)) {
int min_dist = INT_MAX, dist, n;
for_each_online_node(n) { for_each_online_node(n) {
dist = node_distance(node, n); dist = node_distance(node, n);
if (dist < min_dist) { if (dist < min_dist) {
...@@ -151,7 +148,6 @@ int numa_map_to_online_node(int node) ...@@ -151,7 +148,6 @@ int numa_map_to_online_node(int node)
min_node = n; min_node = n;
} }
} }
}
return min_node; return min_node;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment