summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMel Gorman <mgorman@techsingularity.net>2019-03-05 18:44:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 00:07:16 -0500
commitefe771c7603bc524425070d651e70e9c56c57f28 (patch)
tree6f39247136da7740a5197e30eb809031cbdd09fa
parent806031bb5ec36ed879d64249d5a5cf9c6657f89d (diff)
mm, compaction: always finish scanning of a full pageblock
When compaction is finishing, it uses a flag to ensure the pageblock is complete but it makes sense to always complete migration of a pageblock. Minimally, skip information is based on a pageblock and partially scanned pageblocks may incur more scanning in the future. The pageblock skip handling also becomes more strict later in the series and the hint is more useful if a complete pageblock was always scanned. The potentially impacts latency as more scanning is done but it's not a consistent win or loss as the scanning is not always a high percentage of the pageblock and sometimes it is offset by future reductions in scanning. Hence, the results are not presented this time due to a misleading mix of gains/losses without any clear pattern. However, full scanning of the pageblock is important for later patches. Link: http://lkml.kernel.org/r/20190118175136.31341-8-mgorman@techsingularity.net Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: David Rientjes <rientjes@google.com> Cc: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/compaction.c19
-rw-r--r--mm/internal.h1
2 files changed, 8 insertions, 12 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 32a88b49f973..3d11c209614a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1331,16 +1331,14 @@ static enum compact_result __compact_finished(struct compact_control *cc)
1331 if (is_via_compact_memory(cc->order)) 1331 if (is_via_compact_memory(cc->order))
1332 return COMPACT_CONTINUE; 1332 return COMPACT_CONTINUE;
1333 1333
1334 if (cc->finishing_block) { 1334 /*
1335 /* 1335 * Always finish scanning a pageblock to reduce the possibility of
1336 * We have finished the pageblock, but better check again that 1336 * fallbacks in the future. This is particularly important when
1337 * we really succeeded. 1337 * migration source is unmovable/reclaimable but it's not worth
1338 */ 1338 * special casing.
1339 if (IS_ALIGNED(cc->migrate_pfn, pageblock_nr_pages)) 1339 */
1340 cc->finishing_block = false; 1340 if (!IS_ALIGNED(cc->migrate_pfn, pageblock_nr_pages))
1341 else 1341 return COMPACT_CONTINUE;
1342 return COMPACT_CONTINUE;
1343 }
1344 1342
1345 /* Direct compactor: Is a suitable page free? */ 1343 /* Direct compactor: Is a suitable page free? */
1346 for (order = cc->order; order < MAX_ORDER; order++) { 1344 for (order = cc->order; order < MAX_ORDER; order++) {
@@ -1382,7 +1380,6 @@ static enum compact_result __compact_finished(struct compact_control *cc)
1382 return COMPACT_SUCCESS; 1380 return COMPACT_SUCCESS;
1383 } 1381 }
1384 1382
1385 cc->finishing_block = true;
1386 return COMPACT_CONTINUE; 1383 return COMPACT_CONTINUE;
1387 } 1384 }
1388 } 1385 }
diff --git a/mm/internal.h b/mm/internal.h
index f40d06d70683..9b32f4cab0ae 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -203,7 +203,6 @@ struct compact_control {
203 bool direct_compaction; /* False from kcompactd or /proc/... */ 203 bool direct_compaction; /* False from kcompactd or /proc/... */
204 bool whole_zone; /* Whole zone should/has been scanned */ 204 bool whole_zone; /* Whole zone should/has been scanned */
205 bool contended; /* Signal lock or sched contention */ 205 bool contended; /* Signal lock or sched contention */
206 bool finishing_block; /* Finishing current pageblock */
207}; 206};
208 207
209unsigned long 208unsigned long