On Fri, 2020-06-19 at 14:59 +-0200, David Hildenbrand wrote: +AD4- Especially with memory hotplug, we can have offline sections (with a +AD4- garbage memmap) and overlapping zones. We have to make sure to only +AD4- touch initialized memmaps (online sections managed by the buddy) and +AD4- that +AD4- the zone matches, to not move pages between zones. +AD4- +AD4- To test if this can actually happen, I added a simple +AD4- BUG+AF8-ON(page+AF8-zone(page+AF8-i) +ACEAPQ- page+AF8-zone(page+AF8-j))+ADs- +AD4- right before the swap. When hotplugging a 256M DIMM to a 4G x86-64 VM +AD4- and +AD4- onlining the first memory block +ACI-online+AF8-movable+ACI- and the second +AD4- memory +AD4- block +ACI-online+AF8-kernel+ACI-, it will trigger the BUG, as both zones (NORMAL +AD4- and MOVABLE) overlap. +AD4- +AD4- This might result in all kinds of weird situations (e.g., double +AD4- allocations, list corruptions, unmovable allocations ending up in the +AD4- movable zone). +AD4- +AD4- Fixes: e900a918b098 (+ACI-mm: shuffle initial free memory to improve +AD4- memory-side-cache utilization+ACI-) +AD4- Acked-by: Michal Hocko +ADw-mhocko+AEA-suse.com+AD4- +AD4- Cc: stable+AEA-vger.kernel.org +ACM- v5.2+- +AD4- Cc: Andrew Morton +ADw-akpm+AEA-linux-foundation.org+AD4- +AD4- Cc: Johannes Weiner +ADw-hannes+AEA-cmpxchg.org+AD4- +AD4- Cc: Michal Hocko +ADw-mhocko+AEA-suse.com+AD4- +AD4- Cc: Minchan Kim +ADw-minchan+AEA-kernel.org+AD4- +AD4- Cc: Huang Ying +ADw-ying.huang+AEA-intel.com+AD4- +AD4- Cc: Wei Yang +ADw-richard.weiyang+AEA-gmail.com+AD4- +AD4- Cc: Mel Gorman +ADw-mgorman+AEA-techsingularity.net+AD4- +AD4- Signed-off-by: David Hildenbrand +ADw-david+AEA-redhat.com+AD4- Looks good to me. Acked-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-