linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
	Gao Xiang <hsiangkao@linux.alibaba.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Michal Hocko <mhocko@kernel.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: [PATCH] mm/page_alloc: avoid high-order page allocation warn with __GFP_NOFAIL
Date: Sun,  5 Mar 2023 13:30:35 +0800	[thread overview]
Message-ID: <20230305053035.1911-1-hsiangkao@linux.alibaba.com> (raw)

My knowledge of this is somewhat limited, however, since vmalloc already
supported __GFP_NOFAIL in commit 9376130c390a ("mm/vmalloc: add
support for __GFP_NOFAIL").  __GFP_NOFAIL could trigger the following
stack and allocate high-order pages when CONFIG_HAVE_ARCH_HUGE_VMALLOC
is enabled:

 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2286
 vm_area_alloc_pages mm/vmalloc.c:2989 [inline]
 __vmalloc_area_node mm/vmalloc.c:3057 [inline]
 __vmalloc_node_range+0x978/0x13c0 mm/vmalloc.c:3227
 kvmalloc_node+0x156/0x1a0 mm/util.c:606
 kvmalloc include/linux/slab.h:737 [inline]
 kvmalloc_array include/linux/slab.h:755 [inline]
 kvcalloc include/linux/slab.h:760 [inline]
 (codebase: Linux 6.2-rc2)

Don't warn such cases since high-order pages with __GFP_NOFAIL is
somewhat legel.

Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 mm/page_alloc.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0745aedebb37..0618716c49df 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3822,12 +3822,6 @@ struct page *rmqueue(struct zone *preferred_zone,
 {
 	struct page *page;
 
-	/*
-	 * We most definitely don't want callers attempting to
-	 * allocate greater than order-1 page units with __GFP_NOFAIL.
-	 */
-	WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));
-
 	if (likely(pcp_allowed_order(order))) {
 		/*
 		 * MIGRATE_MOVABLE pcplist could have the pages on CMA area and
-- 
2.24.4



             reply	other threads:[~2023-03-05  5:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-05  5:30 Gao Xiang [this message]
2023-03-06  7:51 ` Michal Hocko
2023-03-06  8:03   ` Gao Xiang
2023-03-06 12:14   ` Uladzislau Rezki
2023-03-06 14:03     ` [PATCH] mm, vmalloc: fix high order __GFP_NOFAIL allocations Michal Hocko
2023-03-06 16:37       ` Uladzislau Rezki
2023-03-06 17:29       ` Vlastimil Babka
2023-03-06 17:38         ` Michal Hocko
2023-03-07  0:58       ` Baoquan He

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=20230305053035.1911-1-hsiangkao@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=vbabka@suse.cz \
    /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