[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230823131350.114942-10-alexandru.elisei@arm.com>
Date: Wed, 23 Aug 2023 14:13:22 +0100
From: Alexandru Elisei <alexandru.elisei@....com>
To: catalin.marinas@....com, will@...nel.org, oliver.upton@...ux.dev,
maz@...nel.org, james.morse@....com, suzuki.poulose@....com,
yuzenghui@...wei.com, arnd@...db.de, akpm@...ux-foundation.org,
mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com, mhiramat@...nel.org,
rppt@...nel.org, hughd@...gle.com
Cc: pcc@...gle.com, steven.price@....com, anshuman.khandual@....com,
vincenzo.frascino@....com, david@...hat.com, eugenis@...gle.com,
kcc@...gle.com, hyesoo.yu@...sung.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kvmarm@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-arch@...r.kernel.org, linux-mm@...ck.org,
linux-trace-kernel@...r.kernel.org
Subject: [PATCH RFC 09/37] mm: compaction: Handle metadata pages as source for direct compaction
Metadata pages can have special requirements and can only be allocated
if an architecture allows it.
In the direct compaction case, the source pages that will be migrated
will then be used to satisfy the allocation request that triggered the
compaction. Make sure that the allocation allows the use of metadata
pages when considering them for migration.
When a page is freed during direct compaction, the page allocator will
try to use that page to satisfy the allocation request. Don't capture a
metadata page in this case, even if the allocation request would allow
it, to increase the chances that the page is free when it needs to be
taken from the allocator to store metadata.
Signed-off-by: Alexandru Elisei <alexandru.elisei@....com>
---
mm/compaction.c | 10 ++++++++--
mm/page_alloc.c | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index f132c02b0655..a29db409c5cc 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -23,6 +23,7 @@
#include <linux/freezer.h>
#include <linux/page_owner.h>
#include <linux/psi.h>
+#include <asm/memory_metadata.h>
#include "internal.h"
#ifdef CONFIG_COMPACTION
@@ -1307,11 +1308,16 @@ static bool suitable_migration_source(struct compact_control *cc,
if (pageblock_skip_persistent(page))
return false;
+ block_mt = get_pageblock_migratetype(page);
+
+ if (metadata_storage_enabled() && cc->direct_compaction &&
+ is_migrate_metadata(block_mt) &&
+ !(cc->alloc_flags & ALLOC_FROM_METADATA))
+ return false;
+
if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction)
return true;
- block_mt = get_pageblock_migratetype(page);
-
if (cc->migratetype == MIGRATE_MOVABLE)
return is_migrate_movable(block_mt);
else
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bbb49b489230..011645d07ce9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -654,6 +654,7 @@ compaction_capture(struct capture_control *capc, struct page *page,
/* Do not accidentally pollute CMA or isolated regions*/
if (is_migrate_cma(migratetype) ||
+ is_migrate_metadata(migratetype) ||
is_migrate_isolate(migratetype))
return false;
--
2.41.0
Powered by blists - more mailing lists