Use early_pfn_to_nid() to get correct node id from base instead of the default NUMA_NO_NODE in cma_declare_contiguous_nid(). Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> --- mm/cma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/cma.c b/mm/cma.c index 2b2494fd6b59..97c27e5fe1a2 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -375,6 +375,9 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, if (ret) goto free_mem; + if (nid == NUMA_NO_NODE) + nid = early_pfn_to_nid(PHYS_PFN(base)); + pr_info("Reserved %ld MiB at %pa on node %d\n", (unsigned long)size / SZ_1M, &base, nid); return 0; -- 2.27.0