[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250915195153.462039-8-fvdl@google.com>
Date: Mon, 15 Sep 2025 19:51:48 +0000
From: Frank van der Linden <fvdl@...gle.com>
To: akpm@...ux-foundation.org, muchun.song@...ux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: hannes@...xchg.org, david@...hat.com, roman.gushchin@...ux.dev,
Frank van der Linden <fvdl@...gle.com>
Subject: [RFC PATCH 07/12] mm/compaction: optionally use a different isolate function
For CMA balancing, the compaction migration hooks can largely
be reused, except a different function to isolate free pages
is needed.
So, add a pointer to the isolation function in the compact_control
structure. If it's not NULL, use it, else use isolate_freepages as
usual.
No functional change.
Signed-off-by: Frank van der Linden <fvdl@...gle.com>
---
mm/compaction.c | 5 ++++-
mm/internal.h | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index bf021b31c7ec..6a2c06e356c5 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1813,7 +1813,10 @@ static struct folio *compaction_alloc_noprof(struct folio *src, unsigned long da
if (start_order == NR_PAGE_ORDERS) {
if (has_isolated_pages)
return NULL;
- isolate_freepages(cc);
+ if (cc->isolate_freepages)
+ cc->isolate_freepages(cc);
+ else
+ isolate_freepages(cc);
has_isolated_pages = true;
goto again;
}
diff --git a/mm/internal.h b/mm/internal.h
index 45b725c3dc03..7916d8be8922 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -873,6 +873,11 @@ struct compact_control {
unsigned int nr_freepages; /* Number of isolated free pages */
unsigned int nr_migratepages; /* Number of pages to migrate */
unsigned long free_pfn; /* isolate_freepages search base */
+ /*
+ * Function to use to isolate free pages, if applicable. If NULL,
+ * default to isolate_freepages().
+ */
+ void (*isolate_freepages)(struct compact_control *cc);
/*
* Acts as an in/out parameter to page isolation for migration.
* isolate_migratepages uses it as a search base.
--
2.51.0.384.g4c02a37b29-goog
Powered by blists - more mailing lists