On Wed 31-01-18 00:42:43, Pavel Tatashin wrote: > This patch was inspired by the discussion of this problem: > http://lkml.kernel.org/r/20180130083006.GB1245@xxxxxxxxxx > > Currently, during memory hotplugging we traverse struct pages several > times: > > 1. memset(0) in sparse_add_one_section() > 2. loop in __add_section() to set do: set_page_node(page, nid); and > SetPageReserved(page); > 3. loop in pages_correctly_reserved() to check that SetPageReserved is set. > 4. loop in memmap_init_zone() to call __init_single_pfn() > > This patch removes loops 1, 2, and 3 and only leaves the loop 4, where all > struct page fields are initialized in one go, the same as it is now done > during boot. So how do we check that there is no page_to_nid() user before we online the page? I remember I was fighting strange bugs when reworking this code. I have forgot all the details of course, I just remember some nasty and subtle code paths. Maybe we have got rid of those in the past year but this should be done really carefully. We might have similar dependences on PageReserved. That being said, it would be great if we could simplify this. I think that 3) can be removed right away. It is a pure paranoia. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>