[PATCH 2/3] mm, compaction: split off flag for not updating skip hints

From: Vlastimil Babka
Date: Thu Nov 02 2017 - 08:17:33 EST


Pageblock skip hints were added as a heuristic for compaction, which shares
core code with CMA. Since CMA reliability would suffer from the heuristics,
compact_control flag ignore_skip_hint was added for the CMA use case.
Since commit 6815bf3f233e ("mm/compaction: respect ignore_skip_hint in
update_pageblock_skip") the flag also means that CMA won't *update* the skip
hints in addition to ignoring them.

Today, direct compaction can also ignore the skip hints in the last resort
attempt, but there's no reason not to set them when isolation fails in such
case. Thus, this patch splits off a new no_set_skip_hint flag to avoid the
updating, which only CMA sets. This should improve the heuristics a bit, and
allow us to simplify the persistent skip bit handling as the next step.

Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
---
mm/compaction.c | 2 +-
mm/internal.h | 1 +
mm/page_alloc.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index be7ab160f251..a92860d89679 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -294,7 +294,7 @@ static void update_pageblock_skip(struct compact_control *cc,
struct zone *zone = cc->zone;
unsigned long pfn;

- if (cc->ignore_skip_hint)
+ if (cc->no_set_skip_hint)
return;

if (!page)
diff --git a/mm/internal.h b/mm/internal.h
index 0aaa05af7833..3e5dc95dc259 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -201,6 +201,7 @@ struct compact_control {
const int classzone_idx; /* zone index of a direct compactor */
enum migrate_mode mode; /* Async or sync migration mode */
bool ignore_skip_hint; /* Scan blocks even if marked skip */
+ bool no_set_skip_hint; /* Don't mark blocks for skipping */
bool ignore_block_suitable; /* Scan blocks considered unsuitable */
bool direct_compaction; /* False from kcompactd or /proc/... */
bool whole_zone; /* Whole zone should/has been scanned */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 67330a438525..79cdac1fee42 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7577,6 +7577,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
.zone = page_zone(pfn_to_page(start)),
.mode = MIGRATE_SYNC,
.ignore_skip_hint = true,
+ .no_set_skip_hint = true,
.gfp_mask = current_gfp_context(gfp_mask),
};
INIT_LIST_HEAD(&cc.migratepages);
--
2.14.3