aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/compaction.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 021a2960ef9e..94bdbe1f7caf 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -420,13 +420,6 @@ static int compact_finished(struct zone *zone,
420 if (cc->free_pfn <= cc->migrate_pfn) 420 if (cc->free_pfn <= cc->migrate_pfn)
421 return COMPACT_COMPLETE; 421 return COMPACT_COMPLETE;
422 422
423 /* Compaction run is not finished if the watermark is not met */
424 watermark = low_wmark_pages(zone);
425 watermark += (1 << cc->order);
426
427 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0))
428 return COMPACT_CONTINUE;
429
430 /* 423 /*
431 * order == -1 is expected when compacting via 424 * order == -1 is expected when compacting via
432 * /proc/sys/vm/compact_memory 425 * /proc/sys/vm/compact_memory
@@ -434,6 +427,13 @@ static int compact_finished(struct zone *zone,
434 if (cc->order == -1) 427 if (cc->order == -1)
435 return COMPACT_CONTINUE; 428 return COMPACT_CONTINUE;
436 429
430 /* Compaction run is not finished if the watermark is not met */
431 watermark = low_wmark_pages(zone);
432 watermark += (1 << cc->order);
433
434 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0))
435 return COMPACT_CONTINUE;
436
437 /* Direct compactor: Is a suitable page free? */ 437 /* Direct compactor: Is a suitable page free? */
438 for (order = cc->order; order < MAX_ORDER; order++) { 438 for (order = cc->order; order < MAX_ORDER; order++) {
439 /* Job done if page is free of the right migratetype */ 439 /* Job done if page is free of the right migratetype */
@@ -461,6 +461,13 @@ unsigned long compaction_suitable(struct zone *zone, int order)
461 unsigned long watermark; 461 unsigned long watermark;
462 462
463 /* 463 /*
464 * order == -1 is expected when compacting via
465 * /proc/sys/vm/compact_memory
466 */
467 if (order == -1)
468 return COMPACT_CONTINUE;
469
470 /*
464 * Watermarks for order-0 must be met for compaction. Note the 2UL. 471 * Watermarks for order-0 must be met for compaction. Note the 2UL.
465 * This is because during migration, copies of pages need to be 472 * This is because during migration, copies of pages need to be
466 * allocated and for a short time, the footprint is higher 473 * allocated and for a short time, the footprint is higher
@@ -470,13 +477,6 @@ unsigned long compaction_suitable(struct zone *zone, int order)
470 return COMPACT_SKIPPED; 477 return COMPACT_SKIPPED;
471 478
472 /* 479 /*
473 * order == -1 is expected when compacting via
474 * /proc/sys/vm/compact_memory
475 */
476 if (order == -1)
477 return COMPACT_CONTINUE;
478
479 /*
480 * fragmentation index determines if allocation failures are due to 480 * fragmentation index determines if allocation failures are due to
481 * low memory or external fragmentation 481 * low memory or external fragmentation
482 * 482 *