aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2018-08-17 18:46:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-17 19:20:29 -0400
commit9ea9a68064035dee70f465f605a3e63990e33bd9 (patch)
treebab1e0e6b994cf84e92d31162241d012ea2e08fb /mm/page_alloc.c
parent974e6d66b6b5c6e2d6a3ccc18b2f9a0b472be5b4 (diff)
mm: drop VM_BUG_ON from __get_free_pages
There is no real reason to blow up just because the caller doesn't know that __get_free_pages cannot return highmem pages. Simply fix that up silently. Even if we have some confused users such a fixup will not be harmful. [akpm@linux-foundation.org: mask off __GFP_HIGHMEM] Link: http://lkml.kernel.org/r/20180622162841.25114-1-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Jiankang Chen <chenjiankang1@huawei.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Yisheng Xie <xieyisheng1@huawei.com> Cc: Hanjun Guo <guohanjun@huawei.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0303a3b24610..e1517bb143dc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4404,19 +4404,15 @@ out:
4404EXPORT_SYMBOL(__alloc_pages_nodemask); 4404EXPORT_SYMBOL(__alloc_pages_nodemask);
4405 4405
4406/* 4406/*
4407 * Common helper functions. 4407 * Common helper functions. Never use with __GFP_HIGHMEM because the returned
4408 * address cannot represent highmem pages. Use alloc_pages and then kmap if
4409 * you need to access high mem.
4408 */ 4410 */
4409unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) 4411unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)
4410{ 4412{
4411 struct page *page; 4413 struct page *page;
4412 4414
4413 /* 4415 page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order);
4414 * __get_free_pages() returns a virtual address, which cannot represent
4415 * a highmem page
4416 */
4417 VM_BUG_ON((gfp_mask & __GFP_HIGHMEM) != 0);
4418
4419 page = alloc_pages(gfp_mask, order);
4420 if (!page) 4416 if (!page)
4421 return 0; 4417 return 0;
4422 return (unsigned long) page_address(page); 4418 return (unsigned long) page_address(page);