mm/sparse: set section nid for hot-add memory
Subsystems (2)
PATCH 1/1 mm/sparse: set section nid for hot-add memory
section_to_node_table[] is used to record section's node id, which is used in page_to_nid(). While for hot-add memory, this is missed.
BTW, current online_pages works because it leverages nid in memory_block. But the granularity of node id should be mem_section wide.
--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)
mm/sparse.c +1 -0
@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,*/ page_init_poison (memmap,sizeof (struct page ) *PAGES_PER_SECTION ); +set_section_nid (section_nr, nid);section_mark_present (ms);sparse_init_one_section (ms, section_nr, memmap, usemap);
Signature · 1 line
2.19.1
Quoted 2 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.
Used for NODE_NOT_IN_PAGE_FLAGS case and it is missed for hot-added memory.
Quoted 2 lines
BTW, current
online_pagesworks because it leverages nid inmemory_block.
It does.
Quoted 1 line
But the granularity of node id should be
mem_sectionwide.
Right.
Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>
Quoted 11 lines · Anshuman Khandual
Quoted 2 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.Used for
NODE_NOT_IN_PAGE_FLAGScase and it is missed for hot-added memory.Quoted 2 lines
BTW, current
online_pagesworks because it leverages nid inmemory_block.It does.
Quoted 8 lines
Quoted 1 line
But the granularity of node id should be
mem_sectionwide.Right.
Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>Reviewed-by Anshuman Khandual <[email protected]>
Thanks
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 5 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
set_section_nid() is only relevant if the NID is not part of the vmemmaps.
Quoted 12 lines
Signed-off-by Wei Yang <[email protected]>--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +0
-0
mm/sparse.c int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, · line 741
Quoted 7 lines
mm/sparse.c +1
-0@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,*/ page_init_poison (memmap,sizeof (struct page ) *PAGES_PER_SECTION ); +set_section_nid (section_nr, nid);section_mark_present (ms);sparse_init_one_section (ms, section_nr, memmap, usemap);
Although I dislike basically all of the current ->nid design, this seems to be the right thing to do
Signature · 3 lines
Thanks, David / dhildenb
Quoted 7 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.Signed-off-by Wei Yang <[email protected]>
While the patch is valid, I think that the changelog could be improved a bit. For example, I would point out the possible problems we can face if it is not set properly (e.g: page_to_nid() operations failing to give the right node) and when section_to_node_table[] is used (NODE_NOT_IN_PAGE_FLAGS scenario).
Quoted 19 lines
--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +1
-0@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,*/ page_init_poison (memmap,sizeof (struct page ) *PAGES_PER_SECTION ); +set_section_nid (section_nr, nid);section_mark_present (ms);sparse_init_one_section (ms, section_nr, memmap, usemap);Signature · 1 line
2.19.1
Signature · 2 lines
Oscar Salvador SUSE L3
Quoted 9 lines · David Hildenbrand
Quoted 5 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
set_section_nid()is only relevant if the NID is not part of the vmemmaps.
Yep, you are right.
Quoted 30 lines
Quoted 12 lines
Signed-off-by Wei Yang <[email protected]>--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +0
-0mm/sparse.c int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, · line 741
Quoted 7 lines
mm/sparse.c +1
-0@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,*/ page_init_poison (memmap,sizeof (struct page ) *PAGES_PER_SECTION ); +set_section_nid (section_nr, nid);section_mark_present (ms);sparse_init_one_section (ms, section_nr, memmap, usemap);Although I dislike basically all of the current ->nid design, this seems to be the right thing to do
Reviewed-by David Hildenbrand <[email protected]>Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 7 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
section_to_node_table[] is used to record section's node id, which is used in
page_to_nid(). While for hot-add memory, this is missed.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
Quoted 7 lines
Quoted 1 line
Signed-off-by Wei Yang <[email protected]>While the patch is valid, I think that the changelog could be improved a bit. For example, I would point out the possible problems we can face if it is not set properly (e.g:
page_to_nid()operations failing to give the right node) and when section_to_node_table[] is used (NODE_NOT_IN_PAGE_FLAGSscenario).
Thanks, let me give more words on this.
Quoted 25 lines
Reviewed-by Oscar Salvador <[email protected]>Quoted 19 lines
--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +1
-0@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,*/ page_init_poison (memmap,sizeof (struct page ) *PAGES_PER_SECTION ); +set_section_nid (section_nr, nid);section_mark_present (ms);sparse_init_one_section (ms, section_nr, memmap, usemap);Signature · 1 line
2.19.1Signature · 2 lines
Oscar Salvador SUSE L3
Signature · 2 lines
Wei Yang Help you, Help me