From: Michal Hocko <mhocko@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: JianKang Chen <chenjiankang1@huawei.com>,
Mel Gorman <mgorman@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
xieyisheng1@huawei.com, guohanjun@huawei.com,
wangkefeng.wang@huawei.com, Michal Hocko <mhocko@suse.com>
Subject: [PATCH] mm: drop VM_BUG_ON from __get_free_pages
Date: Fri, 22 Jun 2018 18:28:41 +0200 [thread overview]
Message-ID: <20180622162841.25114-1-mhocko@kernel.org> (raw)
From: Michal Hocko <mhocko@suse.com>
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.
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
Hi Andrew,
previously posted [1] but it fell through cracks. Can we merge it now?
[1] http://lkml.kernel.org/r/20171129160446.jluzpv3n6mjc3fwv@dhcp22.suse.cz
mm/page_alloc.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1521100f1e63..5f56f662a52d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4402,18 +4402,14 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
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);
if (!page)
return 0;
--
2.17.1
next reply other threads:[~2018-06-22 16:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 16:28 Michal Hocko [this message]
2018-06-26 13:57 ` Vlastimil Babka
2018-06-26 14:44 ` Michal Hocko
2018-06-26 17:04 ` Andrew Morton
2018-06-27 7:34 ` Michal Hocko
2018-06-27 7:39 ` Michal Hocko
2018-06-27 7:50 ` Vlastimil Babka
2018-06-27 7:54 ` Michal Hocko
2018-06-27 10:47 ` Vlastimil Babka
2018-06-27 11:05 ` Michal Hocko
2018-06-27 21:14 ` Andrew Morton
2018-06-27 21:24 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180622162841.25114-1-mhocko@kernel.org \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chenjiankang1@huawei.com \
--cc=guohanjun@huawei.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=wangkefeng.wang@huawei.com \
--cc=xieyisheng1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox