diff options
author | Michal Hocko <[email protected]> | 2018-08-17 15:46:01 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-08-17 16:20:29 -0700 |
commit | 9ea9a68064035dee70f465f605a3e63990e33bd9 (patch) | |
tree | bab1e0e6b994cf84e92d31162241d012ea2e08fb | |
parent | 974e6d66b6b5c6e2d6a3ccc18b2f9a0b472be5b4 (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.
[[email protected]: mask off __GFP_HIGHMEM]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Michal Hocko <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Jiankang Chen <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Yisheng Xie <[email protected]>
Cc: Hanjun Guo <[email protected]>
Cc: Kefeng Wang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/page_alloc.c | 12 |
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: EXPORT_SYMBOL(__alloc_pages_nodemask); /* - * Common helper functions. + * Common helper functions. Never use with __GFP_HIGHMEM because the returned + * address cannot represent highmem pages. Use alloc_pages and then kmap if + * you need to access high mem. */ unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) { struct page *page; - /* - * __get_free_pages() returns a virtual address, which cannot represent - * a highmem page - */ - VM_BUG_ON((gfp_mask & __GFP_HIGHMEM) != 0); - - page = alloc_pages(gfp_mask, order); + page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order); if (!page) return 0; return (unsigned long) page_address(page); |