The patch titled Subject: mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2 has been added to the -mm tree. Its filename is mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> Subject: mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2 - document rescue_unmovable_pageblock() - enum result_smt -> enum_smt_result - fix suitable_migration_target() documentation - add comment about zeroing cc->nr_pageblocks_skipped - fix FAIL_UNMOVABLE_TARGET handling in isolate_freepages() Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/compaction.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff -puN mm/compaction.c~mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2 mm/compaction.c --- a/mm/compaction.c~mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2 +++ a/mm/compaction.c @@ -358,6 +358,10 @@ isolate_migratepages_range(struct zone * #endif /* CONFIG_COMPACTION || CONFIG_CMA */ #ifdef CONFIG_COMPACTION +/* + * Returns true if MIGRATE_UNMOVABLE pageblock was successfully + * converted to MIGRATE_MOVABLE type, false otherwise. + */ static bool rescue_unmovable_pageblock(struct page *page) { unsigned long pfn, start_pfn, end_pfn; @@ -397,14 +401,18 @@ static bool rescue_unmovable_pageblock(s return true; } -enum result_smt { +enum smt_result { GOOD_AS_MIGRATION_TARGET, - FAIL_UNMOVABLE, - FAIL_ETC_REASON, + FAIL_UNMOVABLE_TARGET, + FAIL_BAD_TARGET, }; -/* Returns true if the page is within a block suitable for migration to */ -static enum result_smt suitable_migration_target(struct page *page, +/* + * Returns GOOD_AS_MIGRATION_TARGET if the page is within a block + * suitable for migration to, FAIL_UNMOVABLE_TARGET if the page + * is within a MIGRATE_UNMOVABLE block, FAIL_BAD_TARGET otherwise. + */ +static enum smt_result suitable_migration_target(struct page *page, struct compact_control *cc) { @@ -412,7 +420,7 @@ static enum result_smt suitable_migratio /* Don't interfere with memory hot-remove or the min_free_kbytes blocks */ if (migratetype == MIGRATE_ISOLATE || migratetype == MIGRATE_RESERVE) - return FAIL_ETC_REASON; + return FAIL_BAD_TARGET; /* If the page is a large free page, then allow migration */ if (PageBuddy(page) && page_order(page) >= pageblock_order) @@ -425,7 +433,7 @@ static enum result_smt suitable_migratio if (cc->mode == COMPACT_ASYNC_MOVABLE && migratetype == MIGRATE_UNMOVABLE) - return FAIL_UNMOVABLE; + return FAIL_UNMOVABLE_TARGET; if (cc->mode != COMPACT_ASYNC_MOVABLE && migratetype == MIGRATE_UNMOVABLE && @@ -433,7 +441,7 @@ static enum result_smt suitable_migratio return GOOD_AS_MIGRATION_TARGET; /* Otherwise skip the block */ - return FAIL_ETC_REASON; + return FAIL_BAD_TARGET; } /* @@ -466,6 +474,11 @@ static void isolate_freepages(struct zon zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages; + /* + * isolate_freepages() may be called more than once during + * compact_zone_order() run and we want only the most recent + * count. + */ cc->nr_pageblocks_skipped = 0; /* @@ -476,7 +489,7 @@ static void isolate_freepages(struct zon for (; pfn > low_pfn && cc->nr_migratepages > nr_freepages; pfn -= pageblock_nr_pages) { unsigned long isolated; - enum result_smt ret; + enum smt_result ret; if (!pfn_valid(pfn)) continue; @@ -495,7 +508,7 @@ static void isolate_freepages(struct zon /* Check the block is suitable for migration */ ret = suitable_migration_target(page, cc); if (ret != GOOD_AS_MIGRATION_TARGET) { - if (ret == FAIL_UNMOVABLE) + if (ret == FAIL_UNMOVABLE_TARGET) cc->nr_pageblocks_skipped++; continue; } @@ -513,7 +526,8 @@ static void isolate_freepages(struct zon isolated = isolate_freepages_block(pfn, end_pfn, freelist, false); nr_freepages += isolated; - } + } else if (ret == FAIL_UNMOVABLE_TARGET) + cc->nr_pageblocks_skipped++; spin_unlock_irqrestore(&zone->lock, flags); /* @@ -745,7 +759,7 @@ static int compact_zone(struct zone *zon nr_migrate = cc->nr_migratepages; err = migrate_pages(&cc->migratepages, compaction_alloc, - (unsigned long)cc, false, + (unsigned long)&cc->freepages, false, (cc->mode == COMPACT_SYNC) ? MIGRATE_SYNC_LIGHT : MIGRATE_ASYNC); update_nr_listpages(cc); _ Subject: Subject: mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2 Patches currently in -mm which might be from b.zolnierkie@xxxxxxxxxxx are mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks.patch mm-compaction-handle-incorrect-migrate_unmovable-type-pageblocks-part-2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html