On Tue, Jun 18, 2019 at 09:49:48AM +0200, Oscar Salvador wrote: >On Tue, Jun 18, 2019 at 08:55:37AM +0800, Wei Yang wrote: >> 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. > >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. > 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. >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 > >> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx> >> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx> >> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> >> Reviewed-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> >> >> --- >> 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(+) >> >> diff --git a/mm/sparse.c b/mm/sparse.c >> index 4012d7f50010..48fa16038cf5 100644 >> --- a/mm/sparse.c >> +++ b/mm/sparse.c >> @@ -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); >> >> -- >> 2.19.1 >> > >-- >Oscar Salvador >SUSE L3 -- Wei Yang Help you, Help me