summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/numa_memblks.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c
index 8f5735fda0a2..3f53464240e8 100644
--- a/mm/numa_memblks.c
+++ b/mm/numa_memblks.c
@@ -570,15 +570,16 @@ static int meminfo_to_nid(struct numa_meminfo *mi, u64 start)
int phys_to_target_node(u64 start)
{
int nid = meminfo_to_nid(&numa_meminfo, start);
+ int reserved_nid = meminfo_to_nid(&numa_reserved_meminfo, start);
/*
- * Prefer online nodes, but if reserved memory might be
- * hot-added continue the search with reserved ranges.
+ * Prefer online nodes unless the address is also described
+ * by reserved ranges, in which case use the reserved nid.
*/
- if (nid != NUMA_NO_NODE)
+ if (nid != NUMA_NO_NODE && reserved_nid == NUMA_NO_NODE)
return nid;
- return meminfo_to_nid(&numa_reserved_meminfo, start);
+ return reserved_nid;
}
EXPORT_SYMBOL_GPL(phys_to_target_node);