On Fri, 2020-06-19 at 14:59 +0200, David Hildenbrand wrote: > Especially with memory hotplug, we can have offline sections (with a > garbage memmap) and overlapping zones. We have to make sure to only > touch initialized memmaps (online sections managed by the buddy) and > that > the zone matches, to not move pages between zones. > > To test if this can actually happen, I added a simple > BUG_ON(page_zone(page_i) != page_zone(page_j)); > right before the swap. When hotplugging a 256M DIMM to a 4G x86-64 VM > and > onlining the first memory block "online_movable" and the second > memory > block "online_kernel", it will trigger the BUG, as both zones (NORMAL > and MOVABLE) overlap. > > This might result in all kinds of weird situations (e.g., double > allocations, list corruptions, unmovable allocations ending up in the > movable zone). > > Fixes: e900a918b098 ("mm: shuffle initial free memory to improve > memory-side-cache utilization") > Acked-by: Michal Hocko <mho...@suse.com> > Cc: sta...@vger.kernel.org # v5.2+ > Cc: Andrew Morton <a...@linux-foundation.org> > Cc: Johannes Weiner <han...@cmpxchg.org> > Cc: Michal Hocko <mho...@suse.com> > Cc: Minchan Kim <minc...@kernel.org> > Cc: Huang Ying <ying.hu...@intel.com> > Cc: Wei Yang <richard.weiy...@gmail.com> > Cc: Mel Gorman <mgor...@techsingularity.net> > Signed-off-by: David Hildenbrand <da...@redhat.com>
Looks good to me. Acked-by: Dan Williams <dan.j.willi...@intel.com>