aboutsummaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2014-10-09 18:27:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:54 -0400
commitf8224aa5a0a4627926019bba7511926393fbee3b (patch)
treeca92929dcf6b8d84382a9e2ccbe3ed2eb7800b25 /mm/compaction.c
parent98dd3b48a7b8e8277f14c2b7d879477efc1ed0d0 (diff)
mm, compaction: do not recheck suitable_migration_target under lock
isolate_freepages_block() rechecks if the pageblock is suitable to be a target for migration after it has taken the zone->lock. However, the check has been optimized to occur only once per pageblock, and compact_checklock_irqsave() might be dropping and reacquiring lock, which means somebody else might have changed the pageblock's migratetype meanwhile. Furthermore, nothing prevents the migratetype to change right after isolate_freepages_block() has finished isolating. Given how imperfect this is, it's simpler to just rely on the check done in isolate_freepages() without lock, and not pretend that the recheck under lock guarantees anything. It is just a heuristic after all. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Christoph Lameter <cl@linux.com> Cc: Rik van Riel <riel@redhat.com> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 1c7195d42e83..7bf150d4e1c8 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -276,7 +276,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
276 struct page *cursor, *valid_page = NULL; 276 struct page *cursor, *valid_page = NULL;
277 unsigned long flags; 277 unsigned long flags;
278 bool locked = false; 278 bool locked = false;
279 bool checked_pageblock = false;
280 279
281 cursor = pfn_to_page(blockpfn); 280 cursor = pfn_to_page(blockpfn);
282 281
@@ -307,18 +306,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
307 if (!locked) 306 if (!locked)
308 break; 307 break;
309 308
310 /* Recheck this is a suitable migration target under lock */
311 if (!strict && !checked_pageblock) {
312 /*
313 * We need to check suitability of pageblock only once
314 * and this isolate_freepages_block() is called with
315 * pageblock range, so just check once is sufficient.
316 */
317 checked_pageblock = true;
318 if (!suitable_migration_target(page))
319 break;
320 }
321
322 /* Recheck this is a buddy page under lock */ 309 /* Recheck this is a buddy page under lock */
323 if (!PageBuddy(page)) 310 if (!PageBuddy(page))
324 goto isolate_fail; 311 goto isolate_fail;