__compact_finished() signals the end of compaction if a page of an order greater than or equal to the requested order if found on a free_area. When allocation of MIGRATE_METADATA pages is allowed, count the number of free metadata storage pages towards the request order. Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx> --- mm/compaction.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index dbc9f86b1934..f132c02b0655 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2208,6 +2208,13 @@ static enum compact_result __compact_finished(struct compact_control *cc) if (migratetype == MIGRATE_MOVABLE && !free_area_empty(area, MIGRATE_CMA)) return COMPACT_SUCCESS; +#endif +#ifdef CONFIG_MEMORY_METADATA + if (metadata_storage_enabled() && + migratetype == MIGRATE_MOVABLE && + (cc->alloc_flags & ALLOC_FROM_METADATA) && + !free_area_empty(area, MIGRATE_METADATA)) + return COMPACT_SUCCESS; #endif /* * Job done if allocation would steal freepages from -- 2.41.0