From patchwork Thu Aug 8 21:34:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13758205 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 45D0AC52D73 for ; Thu, 8 Aug 2024 21:34:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8433F6B0092; Thu, 8 Aug 2024 17:34:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DF686B0095; Thu, 8 Aug 2024 17:34:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5583E6B0098; Thu, 8 Aug 2024 17:34:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 39E066B0092 for ; Thu, 8 Aug 2024 17:34:43 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DF3ABA5AB0 for ; Thu, 8 Aug 2024 21:34:42 +0000 (UTC) X-FDA: 82430382804.10.CC7DACC Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by imf13.hostedemail.com (Postfix) with ESMTP id 2B2BA2000B for ; Thu, 8 Aug 2024 21:34:40 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=PkhhTpYY; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf13.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723152808; 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:in-reply-to:references:references:dkim-signature; bh=2Zfyh9sb1bnT5AOZDmCrIADGqpbj2HcF73SygbadHf0=; b=kHrcphK12rIXJ1RI3dq7STUnh+g/KAYEiPFV0zhDo8ECIUWDabND4ATLanRFPHhJy0R2eU EcUMsZscTU36R3QfFc0tb4Gv14LPXugku7JPzZm5Quhf6yaZ1U3mySsO91lFhikh2OEd2Q Z9sg1eF3lDCPJI6JwMS0Ulo3xUXGUu8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723152808; a=rsa-sha256; cv=none; b=IZvOr53vI4iLW1iEnUNzoRFKNPaqNe0j8GfEuANC7EOtB+9uqc8euzeIAkjXgN7s49oS8Q FxHv4WPHjKSpF+P1EKB+W2/gCzmpe3iAXILECMY/BDLFNHU6yn7dLeXGq2/psXvG5Bl8Z3 uWu/qg20A33PCd4kkPIy4xxGbylIx7U= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=PkhhTpYY; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf13.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6bb987d3a98so8027606d6.1 for ; Thu, 08 Aug 2024 14:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723152880; x=1723757680; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2Zfyh9sb1bnT5AOZDmCrIADGqpbj2HcF73SygbadHf0=; b=PkhhTpYYomC0wCJdnX6+Vdt8fyVz1ZQI6WJJgXRHG4xZsowQBYTvwU+h2whbWQuDdM vdLudsWUQu+kJx6YeJLHR3LlOTVFAX3Gg4ezc0QjD6o3yW3ukXQDVYBS9HP4/DdrGljc t/SUFJ0OnXyR2PxBLRxctiATUrDM08EpCJYZbCoZd5srnT57u4xyU/011lCN2pU5iPpI 8LdgiXYus5cHlATT9fGwCVppcr2VrSSBHEo53uWZDFfSmrLiPT5Wr0jxa5Y20qtY8hMF 3TGzc+sYG6rlxJgUtDFOWg2337+WiGz8HwMQIeMJn2mnlvNRbieNC5D93aKOO0cpIHpZ Mdbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723152880; x=1723757680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Zfyh9sb1bnT5AOZDmCrIADGqpbj2HcF73SygbadHf0=; b=Ezsqyg7xtLlDKwSnd62tbmsHeDfnn5ZI9wnuvOsPiAuPGHYikkhrlsWIyNRfWRMblD N/xnG8iqu6AXYyFighQnEnUZj8rR4acOm1RLbihPU0xAA+8vAC8Kx1dp/y5V0WZUvG1I ENUhcF43ytXW1hgHjWjjrolGZIchcy5/Yy90wCwm7SsKpb2JTKFaNU9A3WMpkbxyk4qW ueUmEasR0s/nNzgGU0p5EGlSoBDx+avOQsvITTrqbJJjS/HldfsJ4FUX+8WUfyq8Z+ge MHABjk6XD8gPWx3bHbUAHjHHqxoAhzpb4quyyU3o2rM9uvaP/Ukn4D9d8/YfMtzwjltb +9UQ== X-Forwarded-Encrypted: i=1; AJvYcCVuUR5Epv+UEKtvx8nlyHaIWeZBvk34IvBjGFt5NJmMYIyFB34dyEDWD2M1dhlC2iP6L6BCdKvGRnxjv5xBo2aDIHY= X-Gm-Message-State: AOJu0YzdhEzTP3nmLJN57ZUPnHdM4WLtDABgT3vHfzT7DXMCz5mcPw+B El8ahgrRE2CL8iF9R2vwcu/xjQs659RAJC8TIn+RnMZ6NkQetCNbftfGxv0CrIU= X-Google-Smtp-Source: AGHT+IEYrhxVpzTUFHMNv2JCMahxEtnVaIB4zBU/Fd+nkSIIYgPtSTnsyB+XCR6jRJ7P++5L69WPeQ== X-Received: by 2002:a05:6214:2b99:b0:6b7:a87b:e9b9 with SMTP id 6a1803df08f44-6bd6bda461fmr32485766d6.48.1723152880168; Thu, 08 Aug 2024 14:34:40 -0700 (PDT) Received: from soleen.c.googlers.com.com (118.239.150.34.bc.googleusercontent.com. [34.150.239.118]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb9c762bd1sm70205026d6.29.2024.08.08.14.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 14:34:39 -0700 (PDT) From: Pasha Tatashin To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-cxl@vger.kernel.org, cerasuolodomenico@gmail.com, hannes@cmpxchg.org, j.granados@samsung.com, lizhijian@fujitsu.com, muchun.song@linux.dev, nphamcs@gmail.com, pasha.tatashin@soleen.com, rientjes@google.com, rppt@kernel.org, souravpanda@google.com, vbabka@suse.cz, willy@infradead.org, dan.j.williams@intel.com, yi.zhang@redhat.com, alison.schofield@intel.com, david@redhat.com, yosryahmed@google.com Subject: [PATCH v4 1/3] mm: don't account memmap on failure Date: Thu, 8 Aug 2024 21:34:34 +0000 Message-ID: <20240808213437.682006-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog In-Reply-To: <20240808213437.682006-1-pasha.tatashin@soleen.com> References: <20240808213437.682006-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2B2BA2000B X-Stat-Signature: 7ukgmaonpizwjs8jjtahjz333xtohz13 X-Rspam-User: X-HE-Tag: 1723152880-203032 X-HE-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ZCR4gn+Vs+RtcCnniD2gWmpVug+vc4y7nwepxDaPrGtO/KgqGY3MvDjNgcQjNhTuO9enQizdfjdBVVMgl3F87fG/Rq2WfgcByA2+IEzWN31H2ePtoHrCqW06cwz99Z2doOAVAl0aG4dUxsbSbeJArH+eIGP/dXNHpJcBo9dQbxxNqh3o5lvgy05Kx5Nmd1ZNAyQ+UYcQ2UY0gGOYp863ERaH/mFa+5CdPGE6B+7wNjAoYHJ6CD5iIj3bBumskQfWgfRqtIV/66uCV6d+HPmJQ+4e45U8cC8Ot/PYj7Bk6lCVkuCo6U6H+D1JYTdgtQk3SwTuEzpU2F2yEWpT0oR6QuA== 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: When we fail to allocate the mmemmap in alloc_vmemmap_page_list(), do not account any already-allocated pages: we're going to free all them before we return from the function. Fixes: 15995a352474 ("mm: report per-page metadata information") Signed-off-by: Pasha Tatashin Reviewed-by: Fan Ni Reviewed-by: Yosry Ahmed Acked-by: David Hildenbrand --- mm/hugetlb_vmemmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 829112b0a914..4f51e0596197 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -392,13 +392,10 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end, for (i = 0; i < nr_pages; i++) { page = alloc_pages_node(nid, gfp_mask, 0); - if (!page) { - mod_node_page_state(NODE_DATA(nid), NR_MEMMAP, i); + if (!page) goto out; - } list_add(&page->lru, list); } - mod_node_page_state(NODE_DATA(nid), NR_MEMMAP, nr_pages); return 0;