From patchwork Thu Aug 8 21:34:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13758204 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 474E4C3DA4A for ; Thu, 8 Aug 2024 21:34:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFB936B008C; Thu, 8 Aug 2024 17:34:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CABBE6B0092; Thu, 8 Aug 2024 17:34:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4C946B0095; Thu, 8 Aug 2024 17:34:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 976216B008C for ; Thu, 8 Aug 2024 17:34:42 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 56526160111 for ; Thu, 8 Aug 2024 21:34:42 +0000 (UTC) X-FDA: 82430382804.26.A3916CA Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf20.hostedemail.com (Postfix) with ESMTP id 886321C002F for ; Thu, 8 Aug 2024 21:34:40 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=eJHzq87r; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.52 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723152827; a=rsa-sha256; cv=none; b=eENWVTREvFVFd10az1d6l1OVgA3ZDcQxzpE7VORSAR6Ue0Swua78U/HOsxcztPdiWyDyD4 apeaI8jJP6upmjOg6++fDjAaraKOBxvwULbHOBqv72frs3+Ru5OGJQouyHVp68cb1HGwbC F9vUawfsch73XpIzaqVuwgaSy3yCvtM= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=eJHzq87r; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.52 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=1723152827; 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=sR4Q4RBNyDlEyEtMKpSg2raAJFHhcndUnkwyiIaahuQ=; b=yNIZW+LF1s9lWvkx5UiHjsllwcZ1eFdo/ui5hr/hvjrATrMavpShLDmoXqPjLFcJ0PLs/2 jSDZpoJ1q7YlrzPUYr4j4opKQayYqmZT+NHbvtfmcwdv06GJUkqV/q8mvvM1Wh8HHLXKE2 BiuLO2lFUvZws1DvTxo9nMxdPclQli0= Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6b7b349a98aso12272926d6.3 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=1723152879; x=1723757679; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sR4Q4RBNyDlEyEtMKpSg2raAJFHhcndUnkwyiIaahuQ=; b=eJHzq87rDE355AKIeuKGb1UI1vO+kjZkG0Akih59KyWevQgOaWgS8A4PPYYn5/Tmer sp4+DgqXZx6xVd1XgwJWMKTGg9nDYWvAg6dDn3REVbhwlZujRiaAkumSVXseXoxKDp7U eNeII6YJ2JgHryfesC7AjyePbUVJn+0XIUguGZ65BrbwABl7wODoikViyj4bvbu9HiFu drOYB8BOUGObX9PkkZ1/h4HmQzjso/4aewZIqANcQ/s/TKRapY4P+kj9d/6rp0L5AivJ /ZwbmFdWHXK+RQ+trwJ568DemJRE6GZ6bIdFKSqZOJYkwkjNFzw7bb1Nfrc5nnl7xVJ2 d3SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723152879; x=1723757679; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sR4Q4RBNyDlEyEtMKpSg2raAJFHhcndUnkwyiIaahuQ=; b=aNx5ETH1BBiALOrFVtc7Ttd570AN6ddafdAUexbyFo59vUvq9QDvPb8uMpx4UWishQ 5nqdXQrfGDVk7RYVN7Rp1bFPDkhZ5CBPj2nJa+/keo7CGRkW9fPvrBksm+aw0juGEtrO lxqud+lhooqNEM/eb4MEhF0HKLDxBhzBFwDa7dBNxTcmGUJIOfLs9AMxdSapNHIxQTQ3 xYpdYOyAZ6LzRE+soo0eaOySoZp64h76VTi+wuhY1zL8zjE9OfgbxvGCpBzDJk347CeF eHJ7UQtnyY5UmZ2efhT6D5G/pIb/NmUBgRCWaUyxNDaOheFdAVe5TcnxiQ6lD2qF2ZAW 0AYw== X-Forwarded-Encrypted: i=1; AJvYcCUWYqIoEHXlz0QKDZyBB167Gon8E/6BEJXAfFWD7p495btyfGErcacjBIxxoVJErd3K+hVnyUZqMup/Uq67SmWFlak= X-Gm-Message-State: AOJu0YydKfGeTLovlVS4YA1rzhpB+RppOiXzqu7FzbffZms0b69WZRdd sRahb1CHJ0YJ96J9g4E5rZ2Xuhnv6rs8uXU6F+IgyfxwHwb/gB1AzSF//hwC2kc= X-Google-Smtp-Source: AGHT+IHhBAY4jB88eZ0nLk17m3lkT6t2c4WPOVLAuUQhNq1gELh0d4mWiwBC5MNPkQLlby32mEfHBg== X-Received: by 2002:a05:6214:33c3:b0:6b7:a175:29b7 with SMTP id 6a1803df08f44-6bd6bda2ed6mr42811146d6.51.1723152879490; Thu, 08 Aug 2024 14:34:39 -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.38 (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 0/3] Fixes for memmap accounting Date: Thu, 8 Aug 2024 21:34:33 +0000 Message-ID: <20240808213437.682006-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 886321C002F X-Stat-Signature: wnj14eo3qs1ar6ittyrz8tqsya5e86hd X-Rspam-User: X-HE-Tag: 1723152880-135374 X-HE-Meta: U2FsdGVkX1/UQvW5YNNbLOylPcFcok7jcEX8koBAEK/0bKH+uJxOwfqMbssUU7w/A7o2FuBqi//4o4M416kYRfoZLFXjL1mcoC7JkUgRaDFzxqzlCVLxyGN86lxjWqkQh+d0w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Wag26n+kCUYunMzB+C5CHIRs6krybRrnSW3dKzbeUaSStA2f4H9Qmb1Yil8POoHxGuFdF/MPbZDwY5uSiiiIsUYjhABIWv7ztQ2ufXDIxlIFfZCt2wPfq52Yk/HWAfgCzlUgYhSyQ5BQGM07YKeUw4QFtQgYEXStrRFGZz9XaCXCskZ+wHp/lqkSLvG1I+woE8Fr5ty9w9g= 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: Memmap accounting provides us with observability of how much memory is used for per-page metadata: i.e. "struct page"'s and "struct page_ext". It also provides with information of how much was allocated using boot allocator (i.e. not part of MemTotal), and how much was allocated using buddy allocated (i.e. part of MemTotal). This small series fixes a few problems that were discovered with the original patch. Changes: - Removed patch 'mm: update the memmap stat before page is freed', as noticed by Yosry after 3/3 that patch is not needed anymore. - renamed nr_memmap to nr_mammp_pages and nr_memmap_boot to nr_memmap_boot_pages as suggested by David Hildenbrand - Added the origianl oops information as suggested by Alison Schofield - Improved commit log message as suggested by David Hildenbrand - Added review-by's, acked-by's, and tested-by's v3: https://lore.kernel.org/linux-mm/20240808154237.220029-1-pasha.tatashin@soleen.com Pasha Tatashin (3): mm: don't account memmap on failure mm: add system wide stats items category mm: don't account memmap per-node include/linux/mmzone.h | 2 -- include/linux/vmstat.h | 22 +++++++----------- mm/hugetlb_vmemmap.c | 13 +++++------ mm/mm_init.c | 3 +-- mm/page_alloc.c | 1 - mm/page_ext.c | 18 ++++----------- mm/sparse-vmemmap.c | 11 ++++----- mm/sparse.c | 5 ++--- mm/vmstat.c | 51 ++++++++++++++++++++---------------------- 9 files changed, 48 insertions(+), 78 deletions(-) Tested-by: Alison Schofield