From patchwork Fri Aug 9 19:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13759156 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 6B1E6C531DA for ; Fri, 9 Aug 2024 19:10:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A3E16B0092; Fri, 9 Aug 2024 15:10:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52B7E6B0095; Fri, 9 Aug 2024 15:10:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A44B6B0098; Fri, 9 Aug 2024 15:10:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1ED9B6B0092 for ; Fri, 9 Aug 2024 15:10:28 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9E1EFA13F4 for ; Fri, 9 Aug 2024 19:10:27 +0000 (UTC) X-FDA: 82433648094.21.C09706E Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by imf14.hostedemail.com (Postfix) with ESMTP id DE6F2100023 for ; Fri, 9 Aug 2024 19:10:25 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Hvk4qxSQ; spf=pass (imf14.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.182 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723230573; 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=fxeU4Jq2TXL16ukpSAmTNaQg3Gap0zA2EvWYWTBfBg0D/n8kICZvkKihKkwApOClfoDgFn vHRa0udZtn6MhXxwRZbvjDuQUksvtgTI2vqHIHju5D7/EgXO5ZB5S+a3duXa6Bxevd7hn3 Exkom9z3V0Sr04qFAyXLsqWXKiwiC7A= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Hvk4qxSQ; spf=pass (imf14.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.182 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723230573; a=rsa-sha256; cv=none; b=Oh/dFKU+X87xGcRxbtxTmLjzfFa8Zy3/hTJLXzT7V6EKX1XmB4tQg9hAtGm7W9ZhsCw0p1 7mdYZT7GpyrznkEM/PlJ2staLl93yYWnxsRoiWlekFpTBf4NC9A7Ue6FglOKQuSinx/KS9 QEIL3mdLA6c3GKXCEdFJX80Pf9g57GQ= Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7a1dcc7bc05so158050485a.0 for ; Fri, 09 Aug 2024 12:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723230625; x=1723835425; 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=Hvk4qxSQ85WMpL4cV1r9Kkat32rMQGmvATDfE66G1Qts9eVxcZZLpmbuXdYau+BjnV kq1EZKj2xKfjxcdHjdFgAMZwqCSwt28vcs2uk98hd4NITKhcWZ/ByQWkQ83lI97lW+Zu ta7p2u01G7HjFMG1y2ZRypd0VOMooR+wkuvszEK93KUZzdih1zPN+tRoHwAmUWQBJziK xIT2ZGnkAqyP+Cebe19w9ztDJrfrL8aQ9DK1srf3eSKdR+aAhphCHWCSyoPI7SIuXkHs W/V639iCm96Yk4dfdfXAYNy+V71I3z1fUDF1MX7QbEvC0Rvs0Z3s70XxJPlusWilXFb5 n+Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723230625; x=1723835425; 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=mZyL7tj7xqhRHB6ITWm7jCZTs3hGp98QJEvuwJzcMVu9eo0lOXacEJUonxkzuIj8Mk goQgfgGozXx68qCkAqG3iyDYCH0kESzv72/aYLy1sa7/O1tJwOQAhBm45UD/2SY0bsAd hJAitzhSbtA+LzxENLQWEh2eYpjHKeIc6L77zNZuirpJCh2Vr+5NTRz4NYveiz+QbDO0 QRvD5p8uQWVEMHX/YoVSm4BF4J7zWXzn9bSoGbJ+apaeyuLhaX7SIVMxrZFQahW31rGp 3A3aJBKpul9kgqmk2+spxx034lwzQxRMSBjdHb2+V6A28HgLh6xc0aL4UZWflLQ4Tkso Bq7A== X-Forwarded-Encrypted: i=1; AJvYcCVt9Y1CRmz3K8F6+xAPibM5DxIo6T54DnFABbIM9P59Ekj0PWdfcz6wJLazzMU8G75PpAju52RXPo+Lr4r8kdYPyDI= X-Gm-Message-State: AOJu0YyYvGfy06c1vPyasqVbul/ogDNVBn62MSD4Rvp7/rin+1F8cGFd J8q43TPVOGk8yxvSmTCxzWgOt0mpzVakDSwrYJzpkAZN108Aw5gcJmmHxhzuanC8NmbF4659025 O X-Google-Smtp-Source: AGHT+IEpJ4kA1QWE3b+JfVVjir9Z6DC5086gWvGsdlrOs2CaZZLaGQY0jZT/CHJjcUlLTfdiOhrm+w== X-Received: by 2002:a05:620a:2486:b0:7a1:d9a6:a9af with SMTP id af79cd13be357-7a4c1860cf6mr306443585a.68.1723230624911; Fri, 09 Aug 2024 12:10:24 -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 af79cd13be357-7a4c7df5a55sm5522085a.86.2024.08.09.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:10:24 -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 v5 1/3] mm: don't account memmap on failure Date: Fri, 9 Aug 2024 19:10:18 +0000 Message-ID: <20240809191020.1142142-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog In-Reply-To: <20240809191020.1142142-1-pasha.tatashin@soleen.com> References: <20240809191020.1142142-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Stat-Signature: izbjeopw8myz5td9sfqxy3wkso6amf1i X-Rspam-User: X-Rspamd-Queue-Id: DE6F2100023 X-Rspamd-Server: rspam02 X-HE-Tag: 1723230625-256792 X-HE-Me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ZLlw0uBHltS4uq4Ai5JVxOCGDTqQ2kltm/ofD++8QzVU6+WboMX5nxlF6RgrzQcQmnL9IhL9J1mkwege4DfIOM3gwxrDNJKFnmCx1ylUjSIGY3rJ1jSUBSnVJVgJsNJHeI2t14Mui6qFFiGgFQyjB9332cYMaISAn6UwV/eRaUCUYo2sXY0QxU5kGPj/aaYviUJxplbwq6stjf/jimVJg322Skbxed6f0R7VM4WNCz7A3n4sXddGgFV2/SC3H2UUsWiuklke8r3mkzPgOqHTlwBARdnBEiwIhwYfKsMLTRoWTxLzUWGL7FCN5GB2OScArYYjKVfPIHOBtiBI07hcoC2L7hnOXqoyyF/clxCr/CdcOLQ== 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 Reviewed-by: Muchun Song Acked-by: David Rientjes --- 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;