All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yajun Deng <yajun.deng@linux.dev>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH] mm/cma: get nid from physical address
Date: Thu, 16 May 2024 17:17:01 +0800	[thread overview]
Message-ID: <20240516091701.1527002-1-yajun.deng@linux.dev> (raw)

The nid passed to cma_declare_contiguous_nid() may be NUMA_NO_NODE,
which is not the actual nid. To get the correct nid, we can get the nid
from physical address.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 mm/cma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/cma.c b/mm/cma.c
index 3e9724716bad..be6cdde32944 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -361,6 +361,7 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
 		kmemleak_ignore_phys(addr);
 		base = addr;
 	}
+	nid = early_pfn_to_nid(PHYS_PFN(base));
 
 	ret = cma_init_reserved_mem(base, size, order_per_bit, name, res_cma);
 	if (ret)
-- 
2.25.1



             reply	other threads:[~2024-05-16  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  9:17 Yajun Deng [this message]
2024-05-16 10:03 ` [PATCH] mm/cma: get nid from physical address Kefeng Wang
2024-05-16 11:16   ` Yajun Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240516091701.1527002-1-yajun.deng@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.