mm/sparse: set section nid for hot-add memory
Subsystems (2)
PATCH v2 1/1 mm/sparse: set section nid for hot-add memory
In case of NODE_NOT_IN_PAGE_FLAGS is set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information, page_to_nid() may not give the right node id.
BTW, current online_pages works because it leverages nid in memory_block. But the granularity of node id should be mem_section wide.
---
v2:
* specify the case NODE_NOT_IN_PAGE_FLAGS is effected.
* list one of the victim page_to_nid()
--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)
mm/sparse.c +1 -0
@@ -733,6 +733,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 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
I forgot to ask this before, but why do you mention online_pages here? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.
online_pages() works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.
Quoted 29 lines
Signed-off-by Wei Yang <[email protected]>Reviewed-by Oscar Salvador <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Anshuman Khandual <[email protected]>---
v2:
* specify the caseNODE_NOT_IN_PAGE_FLAGSis effected.
* list one of the victimpage_to_nid()--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +1
-0@@ -733,6 +733,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 5 lines · Oscar Salvador
Quoted 4 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.
Quoted 7 lines
Quoted 2 lines
BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.
Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
Quoted 5 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.
So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
* for initial memory, section wide
* for hot-add memory, mem_block wide
Quoted 34 lines
Quoted 30 lines
Signed-off-by Wei Yang <[email protected]>Reviewed-by Oscar Salvador <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Anshuman Khandual <[email protected]>---
v2:
* specify the caseNODE_NOT_IN_PAGE_FLAGSis effected.
* list one of the victimpage_to_nid()--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +1
-0@@ -733,6 +733,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
Quoted 9 lines · Wei Yang
Quoted 8 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
Quoted 8 lines
Quoted 4 lines
I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
I'd also drop the comment here.
Quoted 7 lines
Quoted 6 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.
Quoted 5 lines
So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
* for initial memory, section wide
* for hot-add memory,mem_blockwide
It's all a big mess. Right now, you can offline initial memory with mixed nodes. Also on my list of many ugly things to clean up.
(I even remember that we can have mixed nodes within a section, but I haven't figured out yet how that is supposed to work in some scenarios)
Signature · 3 lines
Thanks, David / dhildenb
Michal Hocko
reviewerQuoted 31 lines · David Hildenbrand
Quoted 9 lines · Wei Yang
Quoted 8 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.Quoted 8 lines
Quoted 4 lines
I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
I'd also drop the comment here.
Quoted 10 lines
Quoted 6 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
Quoted 8 lines
Quoted 2 lines
* for initial memory, section wide
* for hot-add memory,mem_blockwideIt's all a big mess. Right now, you can offline initial memory with mixed nodes. Also on my list of many ugly things to clean up.
(I even remember that we can have mixed nodes within a section, but I haven't figured out yet how that is supposed to work in some scenarios)
Yes, that is indeed the case. See 4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a. How to fix this? Well, I do not think we can. Section based granularity simply doesn't agree with the reality and so we have to live with that. There is a long way to remove all those section size assumptions from the code though.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 38 lines · Michal Hocko
Quoted 37 lines · David Hildenbrand
Quoted 9 lines · Wei Yang
Quoted 8 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.Quoted 8 lines
Quoted 4 lines
I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
I'd also drop the comment here.
Quoted 7 lines
Quoted 6 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.Quoted 5 lines
So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
* for initial memory, section wide
* for hot-add memory,mem_blockwideIt's all a big mess. Right now, you can offline initial memory with mixed nodes. Also on my list of many ugly things to clean up.
Quoted 9 lines
Quoted 2 lines
(I even remember that we can have mixed nodes within a section, but I haven't figured out yet how that is supposed to work in some scenarios)
Yes, that is indeed the case. See
4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a. How to fix this? Well, I do not think we can. Section based granularity simply doesn't agree with the reality and so we have to live with that. There is a long way to remove all those section size assumptions from the code though.
Trying to remove NODE_NOT_IN_PAGE_FLAGS could work, but we would have to identify how exactly needs that. For memory blocks, we need a different approach (I have in my head to make ->nid indicate if we are dealing with mixed nodes. If mixed, disallow onlining/offlining).
Signature · 3 lines
Thanks, David / dhildenb
Michal Hocko
reviewerQuoted 49 lines · David Hildenbrand
Quoted 38 lines · Michal Hocko
Quoted 37 lines · David Hildenbrand
Quoted 9 lines · Wei Yang
Quoted 8 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.Quoted 8 lines
Quoted 4 lines
I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
I'd also drop the comment here.
Quoted 7 lines
Quoted 6 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.Quoted 5 lines
So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
* for initial memory, section wide
* for hot-add memory,mem_blockwideIt's all a big mess. Right now, you can offline initial memory with mixed nodes. Also on my list of many ugly things to clean up.
Quoted 9 lines
Quoted 2 lines
(I even remember that we can have mixed nodes within a section, but I haven't figured out yet how that is supposed to work in some scenarios)
Yes, that is indeed the case. See
4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a. How to fix this? Well, I do not think we can. Section based granularity simply doesn't agree with the reality and so we have to live with that. There is a long way to remove all those section size assumptions from the code though.
Quoted 4 lines
Trying to remove
NODE_NOT_IN_PAGE_FLAGScould work, but we would have to identify how exactly needs that. For memory blocks, we need a different approach (I have in my head to make ->nid indicate if we are dealing with mixed nodes. If mixed, disallow onlining/offlining).
Well, I am not sure we really have to care about mutli-nodes memblocks much. The API is clumsy but does anybody actually care? The vast majority of hotplug usecases simply do not do that in the first place right? And if they do need a smaller granularity to describe their memory topology then we need a different user API rather the fiddle with implementation details I would argue.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 55 lines · Michal Hocko
Quoted 49 lines · David Hildenbrand
Quoted 38 lines · Michal Hocko
Quoted 37 lines · David Hildenbrand
Quoted 9 lines · Wei Yang
Quoted 8 lines · Oscar Salvador
Quoted 6 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.Quoted 8 lines
Quoted 4 lines
I forgot to ask this before, but why do you mention
online_pageshere? IMHO, it does not add any value to the changelog, and it does not have much to do with the matter.Since to me it is a little confused why we don't set the node info but still could online memory to the correct node. It turns out we leverage the information in memblock.
I'd also drop the comment here.
Quoted 7 lines
Quoted 6 lines
online_pages()works with memblock granularity and not section granularity. That memblock is just a hot-added range of memory, worth of either 1 section or multiple sections, depending on the arch or on the size of the current memory.
And we assume that each hot-added memory all belongs to the same node.Quoted 5 lines
So I am not clear about the granularity of node id. section based or memblock based. Or we have two cases:
* for initial memory, section wide
* for hot-add memory,mem_blockwideIt's all a big mess. Right now, you can offline initial memory with mixed nodes. Also on my list of many ugly things to clean up.
Quoted 9 lines
Quoted 2 lines
(I even remember that we can have mixed nodes within a section, but I haven't figured out yet how that is supposed to work in some scenarios)
Yes, that is indeed the case. See
4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a. How to fix this? Well, I do not think we can. Section based granularity simply doesn't agree with the reality and so we have to live with that. There is a long way to remove all those section size assumptions from the code though.Quoted 4 lines
Trying to remove
NODE_NOT_IN_PAGE_FLAGScould work, but we would have to identify how exactly needs that. For memory blocks, we need a different approach (I have in my head to make ->nid indicate if we are dealing with mixed nodes. If mixed, disallow onlining/offlining).
Quoted 4 lines
Well, I am not sure we really have to care about mutli-nodes memblocks much. The API is clumsy but does anybody actually care? The vast majority of hotplug usecases simply do not do that in the first place right?
Yes, AFAIK it could be done, resulting in unpredictable outcome.
And if they do need a smaller granularity to describe their
Quoted 3 lines
memory topology then we need a different user API rather the fiddle with implementation details I would argue.
It is not about supporting it, it is about properly blocking it.
Signature · 3 lines
Thanks, David / dhildenb
Michal Hocko
reviewerQuoted 1 line · David Hildenbrand
On 19.06.19 11:01, Michal Hocko wrote:
[...]
Quoted 6 lines
Quoted 4 lines
And if they do need a smaller granularity to describe their memory topology then we need a different user API rather the fiddle with implementation details I would argue.
It is not about supporting it, it is about properly blocking it.
We already do that in test_pages_in_a_zone, right? Albeit in MAX_ORDER_NR_PAGES granularity.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 8 lines · Michal Hocko
Quoted 1 line · David Hildenbrand
On 19.06.19 11:01, Michal Hocko wrote:
[...]
Quoted 5 lines
Quoted 4 lines
And if they do need a smaller granularity to describe their memory topology then we need a different user API rather the fiddle with implementation details I would argue.
Quoted 5 lines
Quoted 1 line
It is not about supporting it, it is about properly blocking it.
We already do that in
test_pages_in_a_zone, right? Albeit inMAX_ORDER_NR_PAGESgranularity.
Indeed, thanks for pointing that out. I knew that we were checking zones but had in my head that it was working on zone idx.
Signature · 3 lines
Thanks, David / dhildenb
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.
Which would mean that NODE_NOT_IN_PAGE_FLAGS doesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it because NODE_NOT_IN_PAGE_FLAGS is rare and essentially unused with the hotplug? page_to_nid providing an incorrect result sounds quite serious to me.
Could you identify when we have introduced this problem? A Fixes tag would sound very useful to me.
Quoted 2 lines
BTW, current
online_pagesworks because it leverages nid inmemory_block. But the granularity of node id should bemem_sectionwide.
This is not really helpful because nothing except for the hotplug really cares about mem blocks. The whole MM really does care about page_to_nid and that is why it matters much more so spending a word or two on that would be more helpful.
Quoted 4 lines
Signed-off-by Wei Yang <[email protected]>Reviewed-by Oscar Salvador <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Anshuman Khandual <[email protected]>
The patch itself looks good to me.
Thanks!
Quoted 24 lines
---
v2:
* specify the caseNODE_NOT_IN_PAGE_FLAGSis effected.
* list one of the victimpage_to_nid()--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)mm/sparse.c +1
-0@@ -733,6 +733,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
Michal Hocko SUSE Labs
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.
The thing is that for NODE_NOT_IN_PAGE_FLAGS to be enabled we need to run out of space in page->flags to store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible on x86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones, NODE_SHIFT grows, or we need more space to store the section) we finally run out of room for the flags though.
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
Signature · 2 lines
Oscar Salvador SUSE L3
Quoted 20 lines · Oscar Salvador
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.The thing is that for
NODE_NOT_IN_PAGE_FLAGSto be enabled we need to run out of space inpage->flagsto store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible onx86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones,NODE_SHIFTgrows, or we need more space to store the section) we finally run out of room for the flags though.
Quoted 3 lines
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
I'd love to see NODE_NOT_IN_PAGE_FLAGS go.
Signature · 3 lines
Thanks, David / dhildenb
Michal Hocko
reviewerQuoted 21 lines · David Hildenbrand
Quoted 20 lines · Oscar Salvador
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.The thing is that for
NODE_NOT_IN_PAGE_FLAGSto be enabled we need to run out of space inpage->flagsto store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible onx86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones,NODE_SHIFTgrows, or we need more space to store the section) we finally run out of room for the flags though.
Quoted 5 lines
Quoted 3 lines
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
I'd love to see
NODE_NOT_IN_PAGE_FLAGSgo.
NODE_NOT_IN_PAGE_FLAGS is an implementation detail on where the information is stored. I cannot say how much it is really needed now but I can see there will be a demand for it in a longer term because page->flags space is scarce and very interesting storage. So I do not see it go away I am afraid.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 22 lines · Michal Hocko
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Oscar Salvador
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.The thing is that for
NODE_NOT_IN_PAGE_FLAGSto be enabled we need to run out of space inpage->flagsto store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible onx86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones,NODE_SHIFTgrows, or we need more space to store the section) we finally run out of room for the flags though.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
I'd love to see
NODE_NOT_IN_PAGE_FLAGSgo.
NODE_NOT_IN_PAGE_FLAGSis an implementation detail on where the information is stored.
Yes and no. Storing it per section clearly doesn't allow storing node information on smaller granularity, like storing in page->flags does.
So no, it is not only an implementation detail.
I cannot say how much it is really needed now but
Quoted 3 lines
I can see there will be a demand for it in a longer term because
page->flagsspace is scarce and very interesting storage. So I do not see it go away I am afraid.
Depends on how performance-critical pfn_to_nid() is. I can't tell.
Signature · 3 lines
Thanks, David / dhildenb
Michal Hocko
reviewerQuoted 29 lines · David Hildenbrand
Quoted 28 lines · Michal Hocko
Quoted 26 lines · David Hildenbrand
Quoted 20 lines · Oscar Salvador
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.The thing is that for
NODE_NOT_IN_PAGE_FLAGSto be enabled we need to run out of space inpage->flagsto store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible onx86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones,NODE_SHIFTgrows, or we need more space to store the section) we finally run out of room for the flags though.Quoted 3 lines
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
I'd love to see
NODE_NOT_IN_PAGE_FLAGSgo.
Quoted 7 lines
Quoted 2 lines
NODE_NOT_IN_PAGE_FLAGSis an implementation detail on where the information is stored.Yes and no. Storing it per section clearly doesn't allow storing node information on smaller granularity, like storing in
page->flagsdoes.So no, it is not only an implementation detail.
Let me try to put it differently. NODE_NOT_IN_PAGE_FLAGS is not about storing the mapping per section. You can do what ever other data structure. NODE_NOT_IN_PAGE_FLAGS is in fact about telling that it is not in page->flags.
Quoted 5 lines
Quoted 4 lines
I cannot say how much it is really needed now but
I can see there will be a demand for it in a longer term becausepage->flagsspace is scarce and very interesting storage. So I do not see it go away I am afraid.Depends on how performance-critical
pfn_to_nid()is. I can't tell.
page_to_node is used in many important code paths. Not in the hotest ones I believe but many of them are quite hot I would say.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 36 lines · Michal Hocko
Quoted 35 lines · David Hildenbrand
Quoted 22 lines · Michal Hocko
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Oscar Salvador
Quoted 10 lines · Michal Hocko
Quoted 3 lines · Wei Yang
In case of
NODE_NOT_IN_PAGE_FLAGSis set, we store section's node id in section_to_node_table[]. While for hot-add memory, this is missed. Without this information,page_to_nid()may not give the right node id.Which would mean that
NODE_NOT_IN_PAGE_FLAGSdoesn't really work with the hotpluged memory, right? Any idea why nobody has noticed this so far? Is it becauseNODE_NOT_IN_PAGE_FLAGSis rare and essentially unused with the hotplug?page_to_nidproviding an incorrect result sounds quite serious to me.The thing is that for
NODE_NOT_IN_PAGE_FLAGSto be enabled we need to run out of space inpage->flagsto store zone, nid and section.
Currently, even with the largest values (with pagetable level 5), that is not possible onx86_64.
It is possible though, that somewhere in the future, when the values get larger (e.g: we add more zones,NODE_SHIFTgrows, or we need more space to store the section) we finally run out of room for the flags though.Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I am not sure about the other arches though, we probably should audit them and see which ones can fall in there.
I'd love to see
NODE_NOT_IN_PAGE_FLAGSgo.
NODE_NOT_IN_PAGE_FLAGSis an implementation detail on where the information is stored.Yes and no. Storing it per section clearly doesn't allow storing node information on smaller granularity, like storing in
page->flagsdoes.
Quoted 6 lines
Quoted 1 line
So no, it is not only an implementation detail.
Let me try to put it differently.
NODE_NOT_IN_PAGE_FLAGSis not about storing the mapping per section. You can do what ever other data structure.NODE_NOT_IN_PAGE_FLAGSis in fact about telling that it is not inpage->flags.
Okay, I get what you are saying. Storing it differently is problematic, though, if we want o minimize memory consumption and have a fast lookup.
I was also looking into avoiding to store the section number in page-flags with CONFIG_SPARSEMEM. Especially, because the CONFIG_HAVE_ARCH_PFN_VALID hack is really ugly. But it's tricky :(
Signature · 3 lines
Thanks, David / dhildenb