Skip to content

Commit b06eda0

Browse files
rikvanrieltorvalds
authored andcommitted
mm,compaction,cma: add alloc_contig flag to compact_control
Patch series "fix THP migration for CMA allocations", v2. Transparent huge pages are allocated with __GFP_MOVABLE, and can end up in CMA memory blocks. Transparent huge pages also have most of the infrastructure in place to allow migration. However, a few pieces were missing, causing THP migration to fail when attempting to use CMA to allocate 1GB hugepages. With these patches in place, THP migration from CMA blocks seems to work, both for anonymous THPs and for tmpfs/shmem THPs. This patch (of 2): Add information to struct compact_control to indicate that the allocator would really like to clear out this specific part of memory, used by for example CMA. Signed-off-by: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Vlastimil Babka <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: David Rientjes <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Zi Yan <[email protected]> Cc: Joonsoo Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent eea274d commit b06eda0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mm/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct compact_control {
229229
bool whole_zone; /* Whole zone should/has been scanned */
230230
bool contended; /* Signal lock or sched contention */
231231
bool rescan; /* Rescanning the same pageblock */
232+
bool alloc_contig; /* alloc_contig_range allocation */
232233
};
233234

234235
/*

mm/page_alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8400,6 +8400,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
84008400
.ignore_skip_hint = true,
84018401
.no_set_skip_hint = true,
84028402
.gfp_mask = current_gfp_context(gfp_mask),
8403+
.alloc_contig = true,
84038404
};
84048405
INIT_LIST_HEAD(&cc.migratepages);
84058406

0 commit comments

Comments
 (0)