Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54586C6FA8E for ; Sun, 5 Mar 2023 05:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbjCEFas (ORCPT ); Sun, 5 Mar 2023 00:30:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjCEFaq (ORCPT ); Sun, 5 Mar 2023 00:30:46 -0500 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD11CD53A for ; Sat, 4 Mar 2023 21:30:44 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R481e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Vd5I5eW_1677994236; Received: from e18g06460.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Vd5I5eW_1677994236) by smtp.aliyun-inc.com; Sun, 05 Mar 2023 13:30:41 +0800 From: Gao Xiang To: Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Gao Xiang , Mel Gorman , Michal Hocko , Vlastimil Babka Subject: [PATCH] mm/page_alloc: avoid high-order page allocation warn with __GFP_NOFAIL Date: Sun, 5 Mar 2023 13:30:35 +0800 Message-Id: <20230305053035.1911-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Michal Hocko Cc: Vlastimil Babka Signed-off-by: Gao Xiang --- 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