From patchwork Sun Jun 30 04:46:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13717051 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95236C27C4F for ; Sun, 30 Jun 2024 04:47:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C2786B0082; Sun, 30 Jun 2024 00:47:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8716D6B0083; Sun, 30 Jun 2024 00:47:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 711786B0085; Sun, 30 Jun 2024 00:47:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 539166B0082 for ; Sun, 30 Jun 2024 00:47:20 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 93334141336 for ; Sun, 30 Jun 2024 04:47:19 +0000 (UTC) X-FDA: 82286320998.09.3DCAA65 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf23.hostedemail.com (Postfix) with ESMTP id 876D914000B for ; Sun, 30 Jun 2024 04:47:17 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gDiGjcrp; dkim=pass header.d=suse.com header.s=susede1 header.b=rE2AWl8v; spf=pass (imf23.hostedemail.com: domain of wqu@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=wqu@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719722827; a=rsa-sha256; cv=none; b=QChxe3vclnlIo1pU3WxqoizKKG5FsxLZsXNRm4/R0+417G7C+3VKQWpaIIUPdBz3/V18zw dKQbl0AtzB7DDoShhEZ0bMUn/hlUa34NrgZkQpwiZq49bEUlWm0cFpeoequLYANv8qN2y7 0dKnSlPnAyW6RbyHVkhJ3iqPfP9licY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gDiGjcrp; dkim=pass header.d=suse.com header.s=susede1 header.b=rE2AWl8v; spf=pass (imf23.hostedemail.com: domain of wqu@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=wqu@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719722827; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=X1YgYH2MX1INAdZBNXDDBsErl1GVvMZEJ/1tjk9KUt8=; b=SGnU1kEFboA8tERT2tDClyp/0FzulPGeSmUWzL3N/G7VTE2pqDISWzZQ3YCAtw+V6WKDfc f441B5ODG70jrnLU5zXWaZvLqqbsWx0ZWlBWjKnjNZzK69O2/OQDkygwgihHsf5Mt3UpCO p0qFLkypZRI6UlwbS7xUyX3uMaZqv7k= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7A9AF21BEA; Sun, 30 Jun 2024 04:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1719722835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X1YgYH2MX1INAdZBNXDDBsErl1GVvMZEJ/1tjk9KUt8=; b=gDiGjcrp2ADhQnM2WE3PAWxUc2kQR4VXscKRBYBn5s9+u7ZhTVQjQxeYuiTb6a1eHYaEyu B9BHTFyoEPJW8KeHdSJ2Y7T8XKI75mwlzwJArI5EoFnqx0SU+Kg4JzDYiqfR/xlbWVcECr oYg3uAMaJDVJhKfbuGCo5I/nGKzdWNE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1719722834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X1YgYH2MX1INAdZBNXDDBsErl1GVvMZEJ/1tjk9KUt8=; b=rE2AWl8vjO96K8qrSV+LT5lb8Wi5No7a8Bb35dPGvgNiLb8VXSCegcjND/o6MwOdDhPnaD ZgmGR8EcVKk0MzPKTHfADy2ovGa2WZuR5rdO/D01I+YzQ1GoYLtE6M949p9d4Ds1hd9jbB ctnBpcrlzDNWvPWmti1+sAmaSgTKHX4= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4B0061340C; Sun, 30 Jun 2024 04:47:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Pt6IAVHjgGZXDwAAD6G6ig (envelope-from ); Sun, 30 Jun 2024 04:47:13 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] mm/page_alloc: unify the warning on NOFAIL and high order allocation Date: Sun, 30 Jun 2024 14:16:51 +0930 Message-ID: <0432aa5966e7bc9d88a05dcacb210b80320e0700.1719722782.git.wqu@suse.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Stat-Signature: 1ne8cquekyugu76rnad7xqasoud5diy9 X-Rspamd-Queue-Id: 876D914000B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719722837-879768 X-HE-Meta: U2FsdGVkX1/nDCJ0uJaXIvH8SZGV4G83pU0+SQiXcPWlnJZ4uBEjQ1wZVE6z8q8P85naXd82YedV3lE0z8C4PXvcoULV5xNYjJVt8rgq7qNukEKODavzCDluuxwhvDSi5Mea3Huwv1Zoy0d/cI/HwSJ+9ffWXkcmG5tAndFZsWpsWdEKq29ms+QevsWJ4eNzNdVhytLgsVz7F51DfnKoW+B6td9JjHtKrS48Wkvm5roIqufH2D+KkR1QiRZ3n2CI09GSpY7oi1uDBkMLhXmFYUnpty0nxN6+gI4gU6DUlXGUEi9XSpk62bHx9hL9+ZqLCymV/aC4yeLk+xuor8RYMiEG0o8IWO1LMSyr8RKlRBs7VrwRLZjVtoWc6NThTqYDVIb6RD1hf+IE4rPaH/wTfheyhGl2zrNsHgCtj9mM+i6rcQ8GfC7IQE0o6bGkcw1ujd+UbH6/7Alx6oCKdRds3tgKhitu8BPUwADyHZK8uZFaZ9+T0qY2zex3/CmMU3n3RpDt1yAlbpowptEjqRmFM8trtMS4VBeMAb+bdJXA+CS4R6031O96j0oUzmc0Y3MWMdw/7R7bpr2M2xv01ZCMLxcU7nhCbOo1CXGZC07JfHR+gSIKj2i3XbuOjuX/e1uHgqsIqsm6n/pflAidowmmdM8nI03ayro6JSIj4EKkQl7/lJKFOaFKObs18kMYh7EaQ8P54Ev3vZPJ1Mlgx6rxQlcZKjs64IloLu/27VcaggQB10v5A5pe07VjivhogLaEOIkLg/+1ZkKl+vouZpgvlzo2TTTghxguqIUyt81uWTvnUL9qXslY74omsSS1wnuif9InyyeyDg3QxuQzU3lmmYf0vepG5ybewUgWS9G905GxquVVXEqt/hLnULhvTbiiQpe8yEY/ekdxUAHAU2B/d8J/rrQWf53SlTVhJLb6q30bV3UT+7UKrClYhIYhlhd1QBIZOIsJoNIOiMIyj+B Plje/Lgu orDsiS2vmfagaj3DtK9zd78MC7gR87Qfa1/CAGRIG0aiN5t8zXfjJKoIlWepflqem8iZak3Yf1t23qfIbpvxUXjEnjIeRMDbWFIHTlSKdnqFIprCN0ygPcDVgU/TshI4UZVfpe6rp5Ce965TMZ4QlLTE9sYlByPdqZejBIohQwkwl6q/8k8Xzj49DPmYZVs5dJkSmVg+9HAIvdU5oYtk/RsBcfcdSTAPfItMAWJUjaTjJkbza/DL4/ixOJn5CUE68zTjI5kcALVkxiD7ReuzIc2RO2kBHcT6w6NdiRTB1hR0AE20zGiIxoRssLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- 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,