linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: unify the warning on NOFAIL and high order allocation
@ 2024-06-30  4:46 Qu Wenruo
  0 siblings, 0 replies; only message in thread
From: Qu Wenruo @ 2024-06-30  4:46 UTC (permalink / raw)
  To: linux-btrfs, linux-mm

Inside rmqueue() there is a dedicated WARN_ON_ONCE() to make sure
__GFP_NOFAIL is not combined with any order > 1 allocation.

However the following locations are doing the same check, but with
order > PAGE_ALLOC_COSTLY_ORDER as the threshold:

- VM_BUG_ON() inside pcp_allowed_order()
- WARN_ON_ONCE_GFP() inside __alloc_pages_may_oom()

So this looks like a behavior mismatch, and it's better to unify all the
__GFP_NOFAIL check using PAGE_ALLOC_COSTLY_ORDER for the order.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 mm/page_alloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9ecf99190ea2..697e5cc7f3f1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3005,9 +3005,11 @@ struct page *rmqueue(struct zone *preferred_zone,
 
 	/*
 	 * We most definitely don't want callers attempting to
-	 * allocate greater than order-1 page units with __GFP_NOFAIL.
+	 * allocate greater than PAGE_ALLOC_COSTLY_ORDER page units
+	 * with __GFP_NOFAIL.
 	 */
-	WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));
+	WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) &&
+		     (order > PAGE_ALLOC_COSTLY_ORDER));
 
 	if (likely(pcp_allowed_order(order))) {
 		page = rmqueue_pcplist(preferred_zone, zone, order,
-- 
2.45.2



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-30  4:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-30  4:46 [PATCH] mm/page_alloc: unify the warning on NOFAIL and high order allocation Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox