* [PATCH] mm/cma: get nid from physical address
@ 2024-05-16 9:17 Yajun Deng
2024-05-16 10:03 ` Kefeng Wang
0 siblings, 1 reply; 3+ messages in thread
From: Yajun Deng @ 2024-05-16 9:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, Yajun Deng
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/cma: get nid from physical address
2024-05-16 9:17 [PATCH] mm/cma: get nid from physical address Yajun Deng
@ 2024-05-16 10:03 ` Kefeng Wang
2024-05-16 11:16 ` Yajun Deng
0 siblings, 1 reply; 3+ messages in thread
From: Kefeng Wang @ 2024-05-16 10:03 UTC (permalink / raw)
To: Yajun Deng, akpm; +Cc: linux-mm, linux-kernel
On 2024/5/16 17:17, Yajun Deng wrote:
> 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.
>
Please check
https://lore.kernel.org/linux-riscv/47437c2b-5946-41c6-ad1b-cc03329eb230@huawei.com/
> 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/cma: get nid from physical address
2024-05-16 10:03 ` Kefeng Wang
@ 2024-05-16 11:16 ` Yajun Deng
0 siblings, 0 replies; 3+ messages in thread
From: Yajun Deng @ 2024-05-16 11:16 UTC (permalink / raw)
To: Kefeng Wang, akpm; +Cc: linux-mm, linux-kernel
May 16, 2024 at 6:03 PM, "Kefeng Wang" <wangkefeng.wang@huawei.com> wrote:
>
> On 2024/5/16 17:17, Yajun Deng wrote:
>
> >
> > 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.
> >
>
> Please check
>
> https://lore.kernel.org/linux-riscv/47437c2b-5946-41c6-ad1b-cc03329eb230@huawei.com/
>
Okay, thanks!
> >
> > 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)
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-16 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16 9:17 [PATCH] mm/cma: get nid from physical address Yajun Deng
2024-05-16 10:03 ` Kefeng Wang
2024-05-16 11:16 ` Yajun Deng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).