mem-offline: disallow page migration to isolated page blocks

The isolated page blocks shouldn't be used as migration destination.

Consider the below scenario:
Pa					Pb
				__offline_pages()
				  isolate the page blocks
migrate the page to
the isolated page block
				offline the memory block

				online the same memory block
				which clears the page refcount
				and try to put the page to buddy

In the above scenario, Pa is migrating the page to the page block on
what Pb is trying to offline after the page block is isolated.

This can cause the issues like wrong page contents, memory offline
failures.

Change-Id: Ibceaa17ed34e4c7f38d555bc82189d7eb212cfcc
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
Charan Teja Reddy 2020-12-23 13:32:07 +05:30
commit ff56a97530

View file

@ -22,6 +22,7 @@
#include <linux/vmstat.h>
#include <linux/mailbox_client.h>
#include <linux/mailbox/qmp.h>
#include <linux/page-isolation.h>
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
#include <soc/qcom/rpm-smd.h>
@ -460,6 +461,12 @@ static void isolate_free_pages(struct movable_zone_fill_control *fc)
continue;
}
if (!(start_pfn % pageblock_nr_pages) &&
is_migrate_isolate_page(page)) {
start_pfn += pageblock_nr_pages - 1;
continue;
}
if (!PageBuddy(page))
continue;