All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/sparsemem: pfn_to_page is not valid yet on SPARSEMEM
@ 2020-02-06 12:53 Wei Yang
  2020-02-06 13:28 ` David Hildenbrand
  2020-02-09 10:36 ` Baoquan He
  0 siblings, 2 replies; 13+ messages in thread
From: Wei Yang @ 2020-02-06 12:53 UTC (permalink / raw)
  To: akpm, osalvador, dan.j.williams
  Cc: linux-mm, linux-kernel, david, bhe, Wei Yang

When we use SPARSEMEM instead of SPARSEMEM_VMEMMAP, pfn_to_page()
doesn't work before sparse_init_one_section() is called. This leads to a
crash when hotplug memory.

We should use memmap as it did.

Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug")
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
CC: Dan Williams <dan.j.williams@intel.com>
---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 5a8599041a2a..2efb24ff8f96 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -882,7 +882,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
 	 * Poison uninitialized struct pages in order to catch invalid flags
 	 * combinations.
 	 */
-	page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages);
+	page_init_poison(memmap, sizeof(struct page) * nr_pages);
 
 	ms = __nr_to_section(section_nr);
 	set_section_nid(section_nr, nid);
-- 
2.17.1


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

end of thread, other threads:[~2020-02-09 10:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 12:53 [PATCH] mm/sparsemem: pfn_to_page is not valid yet on SPARSEMEM Wei Yang
2020-02-06 13:28 ` David Hildenbrand
2020-02-06 13:50   ` Baoquan He
2020-02-06 13:55     ` David Hildenbrand
2020-02-06 14:07       ` Baoquan He
2020-02-06 14:37         ` David Hildenbrand
2020-02-06 22:15           ` Wei Yang
2020-02-07  7:23           ` Baoquan He
2020-02-06 14:15     ` Wei Yang
2020-02-06 13:57   ` Wei Yang
2020-02-06 13:59     ` David Hildenbrand
2020-02-06 14:14       ` Wei Yang
2020-02-09 10:36 ` Baoquan He

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.