mm/sparsemem: pfn_to_page is not valid yet on SPARSEMEM
Subsystems (2)
PATCH 1/1 mm/sparsemem: pfn_to_page is not valid yet on SPARSEMEM
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.
--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0
mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);
If you add sub-sections that don't fall onto the start of the section,
pfn_to_page(start_pfn) != memmap
and your patch would break that under SPARSEMEM_VMEMMAP if I am not wrong.
Instead of memmap, there would have to be something like
memmap + (start_pfn - SECTION_ALIGN_DOWN(start_pfn))
If I am not wrong :)
Signature · 3 lines
Thanks, David / dhildenb
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.
It returns the pfn_to_page(pfn) from __populate_section_memmap() and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.
Quoted 11 lines
Instead of memmap, there would have to be something like
memmap + (
start_pfn-SECTION_ALIGN_DOWN(start_pfn))If I am not wrong :)
Signature · 3 lines
Thanks, David / dhildenb
Quoted 28 lines · Baoquan He
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 7 lines
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.
I'm sorry, I can't follow :) Can you elaborate?
Was your comment targeted at why the old code cannot be broken or why this patch cannot be broken?
Signature · 3 lines
Thanks, David / dhildenb
Quoted 33 lines · David Hildenbrand
Quoted 32 lines · Baoquan He
Quoted 30 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.
Quoted 8 lines
Quoted 3 lines
It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.I'm sorry, I can't follow :) Can you elaborate?
Was your comment targeted at why the old code cannot be broken or why this patch cannot be broken?
Sorry for the confusion :-) the latter. I mean the returned memmap has been at the pfn_to_page(start_pfn) in SPARSEMEM_VMEMMAP case.
David Hildenbrand
Acked-byQuoted 38 lines · Baoquan He
Quoted 37 lines · David Hildenbrand
Quoted 35 lines · Baoquan He
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.
Quoted 7 lines
Quoted 4 lines
I'm sorry, I can't follow :) Can you elaborate?
Was your comment targeted at why the old code cannot be broken or why this patch cannot be broken?
Sorry for the confusion :-) the latter. I mean the returned memmap has been at the
pfn_to_page(start_pfn)inSPARSEMEM_VMEMMAPcase.
Yeah, at least for SPARSEMEM_VMEMMAP it is indeed right. Thanks :)
Now, about SPARSEMEM:
populate_section_memmap() does not care about nr_pages and will allocate a memmap for the whole section. So, whenever we add sub-sections to a section, we allocate a new memmap for the whole section. And we do overwrite the memmap pointer in our section. ( sparse_add_section() )
That makes me assume that sub-section hot-add under SPARSEMEM is either
a) never enabled and only works with SPARSEMEM_VMEMMAP
b) horribly broken
And I think a) applies (looking at pfn_section_valid()). Therefore, we don't have to care about sub-section hot-add specifics (and I would be broken already)
Signature · 3 lines
Thanks, David / dhildenb
Quoted 57 lines · David Hildenbrand
Quoted 38 lines · Baoquan He
Quoted 37 lines · David Hildenbrand
Quoted 35 lines · Baoquan He
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.Quoted 7 lines
Quoted 4 lines
I'm sorry, I can't follow :) Can you elaborate?
Was your comment targeted at why the old code cannot be broken or why this patch cannot be broken?
Sorry for the confusion :-) the latter. I mean the returned memmap has been at the
pfn_to_page(start_pfn)inSPARSEMEM_VMEMMAPcase.Yeah, at least for
SPARSEMEM_VMEMMAPit is indeed right. Thanks :)Now, about SPARSEMEM:
populate_section_memmap()does not care aboutnr_pagesand will allocate a memmap for the whole section. So, whenever we add sub-sections to a section, we allocate a new memmap for the whole section. And we do overwrite the memmap pointer in our section. (sparse_add_section())
Quoted 8 lines
That makes me assume that sub-section hot-add under SPARSEMEM is either
a) never enabled and only works with
SPARSEMEM_VMEMMAP
b) horribly brokenAnd I think a) applies (looking at
pfn_section_valid()). Therefore, we don't have to care about sub-section hot-add specifics (and I would be broken already)
Yes, I am looking into this problem. Actually, there maybe another problem.
Just get my brain refreshed, need some time to dig into.
Quoted 7 lines
Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 57 lines · David Hildenbrand
Quoted 38 lines · Baoquan He
Quoted 37 lines · David Hildenbrand
Quoted 35 lines · Baoquan He
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.Quoted 7 lines
Quoted 4 lines
I'm sorry, I can't follow :) Can you elaborate?
Was your comment targeted at why the old code cannot be broken or why this patch cannot be broken?
Sorry for the confusion :-) the latter. I mean the returned memmap has been at the
pfn_to_page(start_pfn)inSPARSEMEM_VMEMMAPcase.Yeah, at least for
SPARSEMEM_VMEMMAPit is indeed right. Thanks :)Now, about SPARSEMEM:
populate_section_memmap()does not care aboutnr_pagesand will allocate a memmap for the whole section. So, whenever we add sub-sections to a section, we allocate a new memmap for the whole section. And we do overwrite the memmap pointer in our section. (sparse_add_section())
Quoted 8 lines
That makes me assume that sub-section hot-add under SPARSEMEM is either
a) never enabled and only works with
SPARSEMEM_VMEMMAP
b) horribly brokenAnd I think a) applies (looking at
pfn_section_valid()). Therefore, we don't have to care about sub-section hot-add specifics (and I would be broken already)
Yeah, I have the same thought as you. And later Dan's words confirms it in another threaad.
Quoted 28 lines · Baoquan He
Quoted 27 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
Quoted 8 lines
Quoted 3 lines
pfn_to_page(start_pfn)!= memmapand your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.It returns the
pfn_to_page(pfn)from__populate_section_memmap()and assign to memmap in vmemmap case, how come it breaks anything. Correct me if I was wrong.
Just see your reply.
Thanks for your explanation. :-)
Quoted 1 line
Quoted 1 line
David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 29 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
pfn_to_page(start_pfn)!= memmap
Quoted 7 lines
and your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.Instead of memmap, there would have to be something like
memmap + (
start_pfn-SECTION_ALIGN_DOWN(start_pfn))If I am not wrong :)
Hi, David, Thanks for your comment.
To be hones, I am not familiar with SPARSEMEM_VMEMMAP. Here is my understanding about section_activate() when SPARSEMEM_VMEMMAP is set.
section_activate(nid, start_pfn, nr_pages, altmap)
populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
__populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
return pfn_to_page(start_pfn)
So the memmap is the page struct for start_pfn when SPARSEMEM_VMEMMAP is set.
Maybe I missed some critical part?
Quoted 5 lines
Signature · 4 lines
-- Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 43 lines · Wei Yang
Quoted 29 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
pfn_to_page(start_pfn)!= memmapQuoted 7 lines
and your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.Instead of memmap, there would have to be something like
memmap + (
start_pfn-SECTION_ALIGN_DOWN(start_pfn))If I am not wrong :)
Hi, David, Thanks for your comment.
To be hones, I am not familiar with
SPARSEMEM_VMEMMAP. Here is my understanding aboutsection_activate()whenSPARSEMEM_VMEMMAPis set.
Quoted 8 lines
section_activate(nid, start_pfn, nr_pages, altmap)
populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
__populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
returnpfn_to_page(start_pfn)So the memmap is the page struct for
start_pfnwhenSPARSEMEM_VMEMMAPis set.Maybe I missed some critical part?
I was assuming that memmap is the memmap of the section, not of the sub-section. (judging from the change in the original patch)
If the right memmap pointer to the sub-section is returned, then we are fine. Will double check :)
Signature · 3 lines
Thanks, David / dhildenb
Quoted 51 lines · David Hildenbrand
Quoted 50 lines · Wei Yang
Quoted 29 lines · David Hildenbrand
Quoted 18 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_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 <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_section(int nid, unsigned long start_pfn, · line 885
Quoted 5 lines
mm/sparse.c +1
-1@@ -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);If you add sub-sections that don't fall onto the start of the section,
pfn_to_page(start_pfn)!= memmapQuoted 7 lines
and your patch would break that under
SPARSEMEM_VMEMMAPif I am not wrong.Instead of memmap, there would have to be something like
memmap + (
start_pfn-SECTION_ALIGN_DOWN(start_pfn))If I am not wrong :)
Hi, David, Thanks for your comment.
To be hones, I am not familiar with
SPARSEMEM_VMEMMAP. Here is my understanding aboutsection_activate()whenSPARSEMEM_VMEMMAPis set.
section_activate(nid, start_pfn, nr_pages, altmap)
populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
__populate_section_mmemap(start_pfn, nr_pages, nid, altmap)
returnpfn_to_page(start_pfn)So the memmap is the page struct for
start_pfnwhenSPARSEMEM_VMEMMAPis set.
Quoted 8 lines
Quoted 1 line
Maybe I missed some critical part?
I was assuming that memmap is the memmap of the section, not of the sub-section. (judging from the change in the original patch)
If the right memmap pointer to the sub-section is returned, then we are fine. Will double check :)
Thanks, your comments are valuable :-)
Quoted 4 lines
Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 5 lines · Wei Yang
When we use SPARSEMEM instead of
SPARSEMEM_VMEMMAP,pfn_to_page()doesn't work beforesparse_init_one_section()is called. This leads to a crash when hotplug memory.We should use memmap as it did.
A good fix, thanks.
By the way, the failure trace should be added to log so that people can know better what happened. And this happened in hot adding side in SPARSEMEM|!VMEMMAP case, the hot removing failed too in this case, I will psot patch to fix it right away.
Quoted 24 lines
Fixes ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug")Signed-off-by Wei Yang <[email protected]>CC Dan Williams <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +1
-1@@ -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);Signature · 1 line
2.17.1