[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210904092053.33037-1-linmiaohe@huawei.com>
Date: Sat, 4 Sep 2021 17:20:53 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <akpm@...ux-foundation.org>
CC: <mhocko@...e.com>, <vbabka@...e.cz>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH] mm/page_isolation: fix potential missing call to unset_migratetype_isolate()
In start_isolate_page_range() undo path, pfn_to_online_page() just checks
the first pfn in a pageblock while __first_valid_page() will traverse the
pageblock until the first online pfn is found. So we may miss the call to
unset_migratetype_isolate() in undo path and pages will remain isolated
unexpectedly. Fix this by calling undo_isolate_page_range() and this will
also help to remove some duplicated codes.
Fixes: 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages")
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
mm/page_isolation.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 471e3a13b541..9bb562d5d194 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -202,14 +202,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
}
return 0;
undo:
- for (pfn = start_pfn;
- pfn < undo_pfn;
- pfn += pageblock_nr_pages) {
- struct page *page = pfn_to_online_page(pfn);
- if (!page)
- continue;
- unset_migratetype_isolate(page, migratetype);
- }
+ undo_isolate_page_range(start_pfn, undo_pfn, migratetype);
return -EBUSY;
}
--
2.23.0
Powered by blists - more mailing lists