linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/1] memremap: devm_memremap_pages has wrong nid
@ 2015-11-11 21:16 Boaz Harrosh
  2015-11-11 21:46 ` Dan Williams
  0 siblings, 1 reply; 11+ messages in thread
From: Boaz Harrosh @ 2015-11-11 21:16 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-fsdevel, linux-nvdimm@lists.01.org


The pmem dev as received in devm_memremap_pages() does not have
its dev->numa_node properly initialized yet.

What I see is that all pmem devices will call arch_add_memory
with nid==0 regardless of the real nid the memory is actually
on. Needless to say that after that all the NUMA page and zone
members (at page->flags) come out wrong.

If I do the below code it will all work properly.

RFC because probably we want to fix dev->numa_node before the
call to devm_memremap_pages.

This is on top of v4.3. I will please need the final fix for Stable@

Thanks
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
 kernel/memremap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/memremap.c b/kernel/memremap.c
index 9d6b555..9409e23 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -183,9 +183,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res)
 
 	memcpy(&page_map->res, res, sizeof(*res));
 
-	nid = dev_to_node(dev);
-	if (nid < 0)
-		nid = 0;
+	nid = memory_add_physaddr_to_nid(res->start);
 
 	error = arch_add_memory(nid, res->start, resource_size(res), true);
 	if (error) {
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-11-17 13:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 21:16 [RFC 1/1] memremap: devm_memremap_pages has wrong nid Boaz Harrosh
2015-11-11 21:46 ` Dan Williams
2015-11-11 22:05   ` Boaz Harrosh
2015-11-12 13:10     ` [PATCH] nvdimm: proper NID in e820_pmem_probe Boaz Harrosh
2015-11-12 13:58       ` Boaz Harrosh
2015-11-12 17:13         ` Dan Williams
2015-11-15 10:08           ` Boaz Harrosh
2015-11-13 16:00   ` [RFC 1/1] memremap: devm_memremap_pages has wrong nid Toshi Kani
2015-11-15  9:17     ` Boaz Harrosh
2015-11-16 17:19       ` Toshi Kani
2015-11-17 13:15         ` Boaz Harrosh

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).