Commit 723a0644a7255f532575fd43245f9ef976491328
Committed by
Linus Torvalds
1 parent
3f6d4caeb9
Exists in
master
and in
20 other branches
mm/page_alloc: refactor out __alloc_contig_migrate_alloc()
__alloc_contig_migrate_alloc() can be used by memory-hotplug so refactor it out (move + rename as a common name) into page_isolation.c. [akpm@linux-foundation.org: checkpatch fixes] Signed-off-by: Minchan Kim <minchan@kernel.org> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 14 additions and 14 deletions Side-by-side Diff
include/linux/page-isolation.h
mm/page_alloc.c
... | ... | @@ -5667,18 +5667,6 @@ |
5667 | 5667 | pageblock_nr_pages)); |
5668 | 5668 | } |
5669 | 5669 | |
5670 | -static struct page * | |
5671 | -__alloc_contig_migrate_alloc(struct page *page, unsigned long private, | |
5672 | - int **resultp) | |
5673 | -{ | |
5674 | - gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE; | |
5675 | - | |
5676 | - if (PageHighMem(page)) | |
5677 | - gfp_mask |= __GFP_HIGHMEM; | |
5678 | - | |
5679 | - return alloc_page(gfp_mask); | |
5680 | -} | |
5681 | - | |
5682 | 5670 | /* [start, end) must belong to a single zone. */ |
5683 | 5671 | static int __alloc_contig_migrate_range(struct compact_control *cc, |
5684 | 5672 | unsigned long start, unsigned long end) |
... | ... | @@ -5714,7 +5702,7 @@ |
5714 | 5702 | reclaim_clean_pages_from_list(cc->zone, &cc->migratepages); |
5715 | 5703 | |
5716 | 5704 | ret = migrate_pages(&cc->migratepages, |
5717 | - __alloc_contig_migrate_alloc, | |
5705 | + alloc_migrate_target, | |
5718 | 5706 | 0, false, MIGRATE_SYNC); |
5719 | 5707 | } |
5720 | 5708 |
mm/page_isolation.c
... | ... | @@ -255,4 +255,15 @@ |
255 | 255 | spin_unlock_irqrestore(&zone->lock, flags); |
256 | 256 | return ret ? 0 : -EBUSY; |
257 | 257 | } |
258 | + | |
259 | +struct page *alloc_migrate_target(struct page *page, unsigned long private, | |
260 | + int **resultp) | |
261 | +{ | |
262 | + gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE; | |
263 | + | |
264 | + if (PageHighMem(page)) | |
265 | + gfp_mask |= __GFP_HIGHMEM; | |
266 | + | |
267 | + return alloc_page(gfp_mask); | |
268 | +} |