diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2016-02-05 18:36:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-05 21:10:40 -0500 |
commit | 080fe2068e1c7f19f565b30b78baf78edf16a980 (patch) | |
tree | d2af16ed6fe7040c1de9a658552753e1dfbdad64 | |
parent | b4330afbed0cdceeba33c4945158c55771047e81 (diff) |
mm, hugetlb: don't require CMA for runtime gigantic pages
Commit 944d9fec8d7a ("hugetlb: add support for gigantic page allocation
at runtime") has added the runtime gigantic page allocation via
alloc_contig_range(), making this support available only when CONFIG_CMA
is enabled. Because it doesn't depend on MIGRATE_CMA pageblocks and the
associated infrastructure, it is possible with few simple adjustments to
require only CONFIG_MEMORY_ISOLATION instead of full CONFIG_CMA.
After this patch, alloc_contig_range() and related functions are
available and used for gigantic pages with just CONFIG_MEMORY_ISOLATION
enabled. Note CONFIG_CMA selects CONFIG_MEMORY_ISOLATION. This allows
supporting runtime gigantic pages without the CMA-specific checks in
page allocator fastpaths.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/x86/mm/hugetlbpage.c | 4 | ||||
-rw-r--r-- | include/linux/gfp.h | 6 | ||||
-rw-r--r-- | mm/hugetlb.c | 2 | ||||
-rw-r--r-- | mm/page_alloc.c | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 42982b26e32b..740d7ac03a55 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c | |||
@@ -173,10 +173,10 @@ static __init int setup_hugepagesz(char *opt) | |||
173 | } | 173 | } |
174 | __setup("hugepagesz=", setup_hugepagesz); | 174 | __setup("hugepagesz=", setup_hugepagesz); |
175 | 175 | ||
176 | #ifdef CONFIG_CMA | 176 | #if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) |
177 | static __init int gigantic_pages_init(void) | 177 | static __init int gigantic_pages_init(void) |
178 | { | 178 | { |
179 | /* With CMA we can allocate gigantic pages at runtime */ | 179 | /* With compaction or CMA we can allocate gigantic pages at runtime */ |
180 | if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT)) | 180 | if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT)) |
181 | hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); | 181 | hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); |
182 | return 0; | 182 | return 0; |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 28ad5f6494b0..af1f2b24bbe4 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -547,16 +547,16 @@ static inline bool pm_suspended_storage(void) | |||
547 | } | 547 | } |
548 | #endif /* CONFIG_PM_SLEEP */ | 548 | #endif /* CONFIG_PM_SLEEP */ |
549 | 549 | ||
550 | #ifdef CONFIG_CMA | 550 | #if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) |
551 | |||
552 | /* The below functions must be run on a range from a single zone. */ | 551 | /* The below functions must be run on a range from a single zone. */ |
553 | extern int alloc_contig_range(unsigned long start, unsigned long end, | 552 | extern int alloc_contig_range(unsigned long start, unsigned long end, |
554 | unsigned migratetype); | 553 | unsigned migratetype); |
555 | extern void free_contig_range(unsigned long pfn, unsigned nr_pages); | 554 | extern void free_contig_range(unsigned long pfn, unsigned nr_pages); |
555 | #endif | ||
556 | 556 | ||
557 | #ifdef CONFIG_CMA | ||
557 | /* CMA stuff */ | 558 | /* CMA stuff */ |
558 | extern void init_cma_reserved_pageblock(struct page *page); | 559 | extern void init_cma_reserved_pageblock(struct page *page); |
559 | |||
560 | #endif | 560 | #endif |
561 | 561 | ||
562 | #endif /* __LINUX_GFP_H */ | 562 | #endif /* __LINUX_GFP_H */ |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d7a802427ea8..06ae13e869d0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -1001,7 +1001,7 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed) | |||
1001 | ((node = hstate_next_node_to_free(hs, mask)) || 1); \ | 1001 | ((node = hstate_next_node_to_free(hs, mask)) || 1); \ |
1002 | nr_nodes--) | 1002 | nr_nodes--) |
1003 | 1003 | ||
1004 | #if defined(CONFIG_CMA) && defined(CONFIG_X86_64) | 1004 | #if defined(CONFIG_X86_64) && ((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA)) |
1005 | static void destroy_compound_gigantic_page(struct page *page, | 1005 | static void destroy_compound_gigantic_page(struct page *page, |
1006 | unsigned int order) | 1006 | unsigned int order) |
1007 | { | 1007 | { |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ea2c4d3e0c03..838ca8bb64f7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -6620,7 +6620,7 @@ bool is_pageblock_removable_nolock(struct page *page) | |||
6620 | return !has_unmovable_pages(zone, page, 0, true); | 6620 | return !has_unmovable_pages(zone, page, 0, true); |
6621 | } | 6621 | } |
6622 | 6622 | ||
6623 | #ifdef CONFIG_CMA | 6623 | #if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) |
6624 | 6624 | ||
6625 | static unsigned long pfn_max_align_down(unsigned long pfn) | 6625 | static unsigned long pfn_max_align_down(unsigned long pfn) |
6626 | { | 6626 | { |