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@xxxxxxxx> --- 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