The draining PCP of CPUs whenever we marked a pageblock MIGRATE_ISOLATE in the big range is too expensive when we consider fact that alloc_pages_bulk is just best effort approach. Thus, this patch avoids the flush when the semantic allows ISOLATE_FAILURE. Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> --- mm/page_isolation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 6208db89a31b..e70bdded02e9 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -54,9 +54,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ out: spin_unlock_irqrestore(&zone->lock, flags); - if (!ret) { - drain_all_pages(zone); - } else { + if (ret) { WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE); if ((isol_flags & REPORT_FAILURE) && unmovable) @@ -197,6 +195,8 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, undo_pfn = pfn; goto undo; } + if (!(flags & ALLOW_ISOLATE_FAILURE)) + drain_all_pages(page_zone(page)); nr_isolate_pageblock++; } } -- 2.28.0.220.ged08abb693-goog