Commit a582a738c763e106f47eab24b8146c698a9c700b

Authored by Shaohua Li
Committed by Linus Torvalds
1 parent 5db8a73a8d

compaction: checks correct fragmentation index

fragmentation_index() returns -1000 when the allocation might succeed
This doesn't match the comment and code in compaction_suitable(). I
thought compaction_suitable should return COMPACT_PARTIAL in -1000
case, because in this case allocation could succeed depending on
watermarks.

The impact of this is that compaction starts and compact_finished() is
called which rechecks the watermarks and the free lists.  It should have
the same result in that compaction should not start but is more expensive.

Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -480,7 +480,8 @@
480 480 * fragmentation index determines if allocation failures are due to
481 481 * low memory or external fragmentation
482 482 *
483   - * index of -1 implies allocations might succeed dependingon watermarks
  483 + * index of -1000 implies allocations might succeed depending on
  484 + * watermarks
484 485 * index towards 0 implies failure is due to lack of memory
485 486 * index towards 1000 implies failure is due to fragmentation
486 487 *
... ... @@ -490,7 +491,8 @@
490 491 if (fragindex >= 0 && fragindex <= sysctl_extfrag_threshold)
491 492 return COMPACT_SKIPPED;
492 493  
493   - if (fragindex == -1 && zone_watermark_ok(zone, order, watermark, 0, 0))
  494 + if (fragindex == -1000 && zone_watermark_ok(zone, order, watermark,
  495 + 0, 0))
494 496 return COMPACT_PARTIAL;
495 497  
496 498 return COMPACT_CONTINUE;