From patchwork Thu Aug 8 15:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13757857 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 BC2B7C52D7B for ; Thu, 8 Aug 2024 15:42:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0E856B00FA; Thu, 8 Aug 2024 11:42:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F9C06B00FC; Thu, 8 Aug 2024 11:42:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8268E6B00FB; Thu, 8 Aug 2024 11:42:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 633D36B00F9 for ; Thu, 8 Aug 2024 11:42:45 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 20BB5A1515 for ; Thu, 8 Aug 2024 15:42:45 +0000 (UTC) X-FDA: 82429495890.28.72C410D Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by imf24.hostedemail.com (Postfix) with ESMTP id 63D06180025 for ; Thu, 8 Aug 2024 15:42:43 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=gtpcc572; spf=pass (imf24.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.48 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=1723131677; 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=y3neo5ZpPv5S0nCnjgNJX6IioRmVVyTly9egBg9Jmdk=; b=n2y9bpr+OKfQS3H+8Npbe8u+LNMka/+4bMNp5lknNo/TvU02wFuK3vC9tcwodqfKTSDoWs 9fzR8Io2mxR+uRNIYmz+CAKcZH5g+JIp0w/dS+KV1cTG9plSd+RAM9udobt5y61mL0hy44 yHBH5yjAytho3i5jtmqUTsClefTTXkI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=gtpcc572; spf=pass (imf24.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.48 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=1723131677; a=rsa-sha256; cv=none; b=wwNdtlgrYsqSsQqEzD7bk5AfiSKAjTwOkvifWWxM3FWYBop9YRHM3gqMA5kwcZesRUtdiT Zuih8QEKIQU3qJVXYGc27FTC1c+yx1X+H2SRQDyOC+S3c+HpJS+4ATP8SEwQ+VxympsOFo 4PM6SrAbpgK+NzstBc1t4xWVgllmlYQ= Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6bb987d3a98so6228416d6.1 for ; Thu, 08 Aug 2024 08:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723131762; x=1723736562; 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=y3neo5ZpPv5S0nCnjgNJX6IioRmVVyTly9egBg9Jmdk=; b=gtpcc572j3mjCd1SDLhDsJVyWDKnZjqVQNGnJveWkDuyLxA20FVNIoSCSnl9Iqm/Kv wGY8beeVfFJMfchDPp0NFKboa9kuDjAL+n5MNv4blemqP9V91uCRs34GZ4mYllorwwmJ BO9JmXWjC8HlmbMjqrBnHRDCARQ0SlPf8/B7f3y/qE/ZDS0J3Zjg9Qx2prwaozZgLWq6 yhnOnGlMTLpNR7EHJ9KZPFDnoU8Vbc6iThGgRU9OkH8Yzb80mKIPWNfr8vT/g8kTYpMq BHsneZ/KDzSHGj8Im1BkzT4WEX6lscZUcwXLXw69w4GOWaV2Cuz7Zo1IwTfnsTfzzWCH ocGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723131762; x=1723736562; 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=y3neo5ZpPv5S0nCnjgNJX6IioRmVVyTly9egBg9Jmdk=; b=Enf7ZFz88m18PajesvyHroNmCfaPcn1yZfEfzfdNqGxf0+nhmEe7u7P3Wvmdfe974O pE78KdVRfsg58wAbTSk7ExR2vXSelBS/OABqPIHT3pIQXKD2B7u/Z670u3U+OggeTrrW bN2JpzYOjEiTpe33VLYJOJfZe72XI+Kylt/+ZBYWERlXlP6KDucrXJuANqKd6+S+wklV QkoUellbkjHZcuhSdUT0nSV8+JsRPtrpGefAOqxlenIO9B6dKfWsXOlYzdbEiuVGilYw IeXpiFKe+Q4tkvQ5acL80NUfIyepaPEM+zwjSjyh3c4s987Yw4RVcPjxu/u/UsLmDJVL 8X2A== X-Forwarded-Encrypted: i=1; AJvYcCVkGSeVukYdlhpNyqBrkyYwGMxQr/YURhWybm5yRSRTIRP6hYmwXM6qiFnNY8bJyIJChpFGLERW2upyxr9oGHJehmA= X-Gm-Message-State: AOJu0Yxd9WE8370iUReQwH6EK6ChDERV55VXceugY+J5Zezdb6H5HViI U2p87kYl8ntcgJtlRFRWwdtiEyCpoOtif+RhXDp4VmzHFReKg5e4zNMU5tR1UY4= X-Google-Smtp-Source: AGHT+IESGfyB5HtXu4zt+BcOgb/gdPZpAEI0Yo2J7Xp64aGcrd7WAVMlzlbxNtl0uyZb/RHkn8qBZg== X-Received: by 2002:a05:6214:3bc5:b0:6b4:4470:81a5 with SMTP id 6a1803df08f44-6bd6bcbb55fmr34927436d6.2.1723131762416; Thu, 08 Aug 2024 08:42:42 -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-6bb9c7b72d9sm67160936d6.60.2024.08.08.08.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:42:41 -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 v3 2/4] mm: don't account memmap on failure Date: Thu, 8 Aug 2024 15:42:35 +0000 Message-ID: <20240808154237.220029-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog In-Reply-To: <20240808154237.220029-1-pasha.tatashin@soleen.com> References: <20240808154237.220029-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 63D06180025 X-Stat-Signature: 199xi791wq7n4toimdc5n6c7p9o6srtn X-Rspam-User: X-HE-Tag: 1723131763-112067 X-HE-Meta: U2FsdGVkX1/RWJL7j5B4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qjGPxdHPMtZfycW/2mi5nJRbGnhBgpYOAzs8fJxJ+A533i78UIaviFSvgGLVqD4NA+7DspArm1Ra4KH1ZGQDSX6aX4sB+I7hwxRtyUUkZbqUlFkz7DUPnuF+fsfPq3pXhoOgF7vxAjGlL6eS1mswGkWvoC7x5FqHLiWualX2u2gBvcTMcX5aAbyPRS1LK03j9vRxO+/5QVRV1QeRJhigBQk7XKzjNvx+uSUIPCQgKQwS3anSuN1GSvjC0xnblOi0JZD8Oqc+uEJaA6ym5z6IsiKy6nDGMO7+3lwCP9NNpq57XskJNqf53ILxtWnRE= 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 in alloc_vmemmap_page_list() memmap is failed to allocate, do not account, the memory is going to be release at the function exit. Fixes: 15995a352474 ("mm: report per-page metadata information") Signed-off-by: Pasha Tatashin Reviewed-by: Yosry Ahmed Reviewed-by: Fan Ni 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 fa83a7b38199..70027869d844 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;