Commit aeef4b83 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds
Browse files

mm, compaction: terminate async compaction when rescheduling

Async compaction terminates prematurely when need_resched(), see
compact_checklock_irqsave().  This can never trigger, however, if the
cond_resched() in isolate_migratepages_range() always takes care of the

If the cond_resched() actually triggers, then terminate this pageblock
scan for async compaction as well.
Signed-off-by: default avatarDavid Rientjes <>
Acked-by: default avatarMel Gorman <>
Acked-by: default avatarVlastimil Babka <>
Cc: Mel Gorman <>
Cc: Vlastimil Babka <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 75f30861
......@@ -494,8 +494,13 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
return 0;
if (cond_resched()) {
/* Async terminates prematurely on need_resched() */
if (cc->mode == MIGRATE_ASYNC)
return 0;
/* Time to isolate some pages for migration */
for (; low_pfn < end_pfn; low_pfn++) {
/* give a chance to irqs before checking need_resched() */
if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment