aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2016-10-07 20:00:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 21:46:29 -0400
commitcc5c9f098fe48a8736add8a23c983524ca16cea5 (patch)
treed48d2ff7f7c1351b3a6b1739e6bcf1c6264f0226 /mm
parent423b452e1553e3d19b632880bf2adf1f058ab267 (diff)
mm, compaction: ignore fragindex from compaction_zonelist_suitable()
The compaction_zonelist_suitable() function tries to determine if compaction will be able to proceed after sufficient reclaim, i.e. whether there are enough reclaimable pages to provide enough order-0 freepages for compaction. This addition of reclaimable pages to the free pages works well for the order-0 watermark check, but in the fragmentation index check we only consider truly free pages. Thus we can get fragindex value close to 0 which indicates failure do to lack of memory, and wrongly decide that compaction won't be suitable even after reclaim. Instead of trying to somehow adjust fragindex for reclaimable pages, let's just skip it from compaction_zonelist_suitable(). Link: http://lkml.kernel.org/r/20160926162025.21555-4-vbabka@suse.cz Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: David Rientjes <rientjes@google.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/compaction.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 86d4d0bbfc7c..b918bdb28aed 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1379,7 +1379,6 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order,
1379 int classzone_idx, 1379 int classzone_idx,
1380 unsigned long wmark_target) 1380 unsigned long wmark_target)
1381{ 1381{
1382 int fragindex;
1383 unsigned long watermark; 1382 unsigned long watermark;
1384 1383
1385 if (is_via_compact_memory(order)) 1384 if (is_via_compact_memory(order))
@@ -1415,6 +1414,18 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order,
1415 ALLOC_CMA, wmark_target)) 1414 ALLOC_CMA, wmark_target))
1416 return COMPACT_SKIPPED; 1415 return COMPACT_SKIPPED;
1417 1416
1417 return COMPACT_CONTINUE;
1418}
1419
1420enum compact_result compaction_suitable(struct zone *zone, int order,
1421 unsigned int alloc_flags,
1422 int classzone_idx)
1423{
1424 enum compact_result ret;
1425 int fragindex;
1426
1427 ret = __compaction_suitable(zone, order, alloc_flags, classzone_idx,
1428 zone_page_state(zone, NR_FREE_PAGES));
1418 /* 1429 /*
1419 * fragmentation index determines if allocation failures are due to 1430 * fragmentation index determines if allocation failures are due to
1420 * low memory or external fragmentation 1431 * low memory or external fragmentation
@@ -1426,21 +1437,12 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order,
1426 * 1437 *
1427 * Only compact if a failure would be due to fragmentation. 1438 * Only compact if a failure would be due to fragmentation.
1428 */ 1439 */
1429 fragindex = fragmentation_index(zone, order); 1440 if (ret == COMPACT_CONTINUE) {
1430 if (fragindex >= 0 && fragindex <= sysctl_extfrag_threshold) 1441 fragindex = fragmentation_index(zone, order);
1431 return COMPACT_NOT_SUITABLE_ZONE; 1442 if (fragindex >= 0 && fragindex <= sysctl_extfrag_threshold)
1432 1443 ret = COMPACT_NOT_SUITABLE_ZONE;
1433 return COMPACT_CONTINUE; 1444 }
1434}
1435
1436enum compact_result compaction_suitable(struct zone *zone, int order,
1437 unsigned int alloc_flags,
1438 int classzone_idx)
1439{
1440 enum compact_result ret;
1441 1445
1442 ret = __compaction_suitable(zone, order, alloc_flags, classzone_idx,
1443 zone_page_state(zone, NR_FREE_PAGES));
1444 trace_mm_compaction_suitable(zone, order, ret); 1446 trace_mm_compaction_suitable(zone, order, ret);
1445 if (ret == COMPACT_NOT_SUITABLE_ZONE) 1447 if (ret == COMPACT_NOT_SUITABLE_ZONE)
1446 ret = COMPACT_SKIPPED; 1448 ret = COMPACT_SKIPPED;
@@ -1473,8 +1475,7 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order,
1473 available += zone_page_state_snapshot(zone, NR_FREE_PAGES); 1475 available += zone_page_state_snapshot(zone, NR_FREE_PAGES);
1474 compact_result = __compaction_suitable(zone, order, alloc_flags, 1476 compact_result = __compaction_suitable(zone, order, alloc_flags,
1475 ac_classzone_idx(ac), available); 1477 ac_classzone_idx(ac), available);
1476 if (compact_result != COMPACT_SKIPPED && 1478 if (compact_result != COMPACT_SKIPPED)
1477 compact_result != COMPACT_NOT_SUITABLE_ZONE)
1478 return true; 1479 return true;
1479 } 1480 }
1480 1481