On Tue 18-06-19 08:55:37, 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. 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. > BTW, current online_pages works because it leverages nid in memory_block. > But the granularity of node id should be mem_section wide. 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. > 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> The patch itself looks good to me. Acked-by: Michal Hocko <mhocko@xxxxxxxx> Thanks! > > --- > 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 -- Michal Hocko SUSE Labs