soc: qcom: mem-offline: isolate freepages in pageblock boundaries

Migrate isolate of a pageblock is being checked only at the pageblock
boundary pages thus the isolation of freepages should happen on that
pageblock which otherwise can still cause the isolation of freepages on
an isolated pageblock.

Consider the below case:

Pa					       Pb

check the pageblock
isolation

zone_lock
Isolate the SWAP_CLUSTER_MAX pages
Zone_unlock
					zone_lock
					Set Migrate isolate on the
					same page block that Pa is
					operating on.
					zone_unlock
zone_lock
Continue the isolate on the same
page block that was set Migrate
isolate by Pb which is an error.

Change-Id: I1504b031f434fb65ebb11e1472b73e9d34e388b8
Fixes: ff56a97530 ("mem-offline: disallow page migration to isolated page blocks")
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
Charan Teja Reddy 2021-01-13 12:22:23 +05:30
commit ae2a72e99d

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/memory.h>
@ -483,8 +483,9 @@ static void isolate_free_pages(struct movable_zone_fill_control *fc)
* returning once we have SWAP_CLUSTER_MAX pages in the
* free list for migration.
*/
if (fc->nr_free_pages >= SWAP_CLUSTER_MAX ||
has_pend_offline_req)
if (!((start_pfn + 1) % pageblock_nr_pages) &&
(fc->nr_free_pages >= SWAP_CLUSTER_MAX ||
has_pend_offline_req))
break;
}
fc->start_pfn = start_pfn + 1;