From: Mel Gorman Date: Fri, 20 May 2016 00:13:58 +0000 (-0700) Subject: mm, page_alloc: check once if a zone has isolated pageblocks X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3777999dd47ec00ec34a151b1d93c0a2b721e822;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mm, page_alloc: check once if a zone has isolated pageblocks When bulk freeing pages from the per-cpu lists the zone is checked for isolated pageblocks on every release. This patch checks it once per drain. [mgorman@techsingularity.net: fix locking radce, per Vlastimil] Signed-off-by: Mel Gorman Signed-off-by: Vlastimil Babka Cc: Vlastimil Babka Cc: Jesper Dangaard Brouer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 48afc1a42bbd..a3b7eb86f912 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -831,8 +831,10 @@ static void free_pcppages_bulk(struct zone *zone, int count, int batch_free = 0; int to_free = count; unsigned long nr_scanned; + bool isolated_pageblocks; spin_lock(&zone->lock); + isolated_pageblocks = has_isolate_pageblock(zone); nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); if (nr_scanned) __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); @@ -870,7 +872,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, /* MIGRATE_ISOLATE page should not go to pcplists */ VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); /* Pageblock could have been isolated meanwhile */ - if (unlikely(has_isolate_pageblock(zone))) + if (unlikely(isolated_pageblocks)) mt = get_pageblock_migratetype(page); __free_one_page(page, page_to_pfn(page), zone, 0, mt);