Re: [RFC PATCH 2/4] mm/page_isolation: remove migratetype from move_freepages_block_isolate()

From: David Hildenbrand
Date: Mon Sep 02 2024 - 10:42:41 EST


On 28.08.24 22:22, Zi Yan wrote:
Since migratetype is no longer overwritten during pageblock isolation,
moving pageblocks to and from MIGRATE_ISOLATE do not need migratetype.

Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
---
include/linux/page-isolation.h | 3 +--
mm/page_alloc.c | 27 +++++++++++++++++++++------
mm/page_isolation.c | 19 +++++++++----------
3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 11b8695115ea..6a62401410c3 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -35,8 +35,7 @@ static inline bool is_migrate_isolate(int migratetype)
void set_pageblock_migratetype(struct page *page, int migratetype);
-bool move_freepages_block_isolate(struct zone *zone, struct page *page,
- int migratetype);
+bool move_freepages_block_isolate(struct zone *zone, struct page *page);
int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
int migratetype, int flags, gfp_t gfp_flags);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4ea5cd1a07e2..dc7c36461953 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1764,10 +1764,12 @@ static unsigned long find_large_buddy(unsigned long start_pfn)
*
* Returns %true if pages could be moved, %false otherwise.
*/
-bool move_freepages_block_isolate(struct zone *zone, struct page *page,
- int migratetype)
+bool move_freepages_block_isolate(struct zone *zone, struct page *page)
{
unsigned long start_pfn, pfn;
+ bool is_block_isolated = get_pageblock_isolate(page);
+ int from_mt;

I think we should have two functions, one that isolates, another one that un-isolates. Or at least make the semantics not depend on the current state of the pageblock.

bool pageblock_set_isolated_and_move_free_pages(struct zone *zone, struct page *page, bool isolated);

vs.

pageblock_isolate_and_move_free_pages()
pageblock_unisolate_and_move_free_pages()

--
Cheers,

David / dhildenb