On Mon 25-03-19 08:40:32, Oscar Salvador wrote: > On Sun, Mar 24, 2019 at 12:18:26PM +0530, Anshuman Khandual wrote: > > Hello Oscar, > > Hi Anshuman, > > > Passing down node ID till unregister_mem_sect_under_nodes() solves the problem of > > querying struct page for nid but the current code assumes that the pfn range for > > any given memory section can have different node IDs. Hence it scans over the > > section and try to remove all possible node <---> memory block sysfs links. > > > > I am just wondering is that assumption even correct ? Can we really have a memory > > section which belongs to different nodes ? Is that even possible. > > Yes, current code assumes that, but looking at when we init sections at boot > stage, it seems like a 1:1 map to me. > > E.g, in memory_present(), we do encode the nid in section's section_mem_map > field to use that later on in sparse_init(), and get the node we should allocate > the data structures from. > > And in memory_present() itself, in case we do not use page's flags field, > we end up using the section_to_node_table[] table, which is clearly a 1:1 map. > > So, I might be wrong here, but I think that we do not really have nodes mixed > in a section. No, unfortunately two nodes might share the same section indeed. Have a look at 4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a -- Michal Hocko SUSE Labs