From ae2a72e99d4bf48beb9272a571f948be56da43d6 Mon Sep 17 00:00:00 2001 From: Charan Teja Reddy Date: Wed, 13 Jan 2021 12:22:23 +0530 Subject: [PATCH] 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: ff56a97530f7 ("mem-offline: disallow page migration to isolated page blocks") Signed-off-by: Charan Teja Reddy --- drivers/soc/qcom/mem-offline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/mem-offline.c b/drivers/soc/qcom/mem-offline.c index 9ce89e6fa54a..aa8e7caad5b7 100644 --- a/drivers/soc/qcom/mem-offline.c +++ b/drivers/soc/qcom/mem-offline.c @@ -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 @@ -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;