Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp315815rdb; Fri, 5 Jan 2024 10:41:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0QtAlWiH5JKblNWIyjhNgGZ19/nUD6avh24bls+ndN5c5rAdRa/irmpm9UbUaUgzsZjny X-Received: by 2002:a17:906:f207:b0:a28:d2d9:4e66 with SMTP id gt7-20020a170906f20700b00a28d2d94e66mr1323285ejb.31.1704480107020; Fri, 05 Jan 2024 10:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704480107; cv=none; d=google.com; s=arc-20160816; b=m2eBUPR7ftSvdtXgX5CIaESq4wbr2g3dxFK7BXtrAQ8wX3BZ1Nh4cg6cCEU6y3v67t fDowLuqLwAGT/HYUi4XhIR7ahupRbMS0Kqq14nR3jU/YSgOb541Uo5DnWSSg55lEJSy8 SeacV1ESA6FlRdxtd8VoDWGykzj6D1K3lymdFsC0vfhSY5ChN2BxsttpUOe84UIkGxxn CskdqT1h6wR/0Rp2AB5lGosttiGC9RkJZUFBLAPuf2FjzhBfFETR6AaQ4KsoaEug+mbs HeUypPK4wezJ6LsFNHDDRiSjZaEIas2JwXvpy7kPkn0uVTGB9EZtjTjVBcm5kxx5lK/b x2+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=+fi0onpTGrV63R/StoJONU4NViJ6wCXVAQDgLv/SfZY=; fh=VdroTgZZ/vOX/4rD399iGtoEpXTnA5/8AlP/lHzF9Zc=; b=rh1bbWZuvVr6INaIDwEsBQ0iXegtxMbhPFbJoZ+znIbCQuv9wadvkRiUoXDFgBrrV0 br3VjuBax18vVS0y7SFFi6JXXmUj3ugJwtZK6hRH6ynI75rb8XNK3MPwzCdx+TMW7F32 sUW8fU/0MNklsJee92TMi2quYN7PZXPkLUJoNkKrDbL4tVEkWHDX8SKCyDqNqLphTuvC A3QMTmWOXLYODXAnelWiBTAanChTOYfcK3uSBKkEJ3sWUBzYmEIqf23LMkVgiKvMc1Cb jhBYk6vFMDbNWeAOHUihvV4z8YUgGbQox3WFGOrIR3BTEBUFEXYYL/+3jGjMYPdhgQPa Qh5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=hxIhcJXg; spf=pass (google.com: domain of linux-kernel+bounces-18228-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18228-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k2-20020a17090666c200b00a26ab41d1c0si837097ejp.59.2024.01.05.10.41.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 10:41:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18228-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=hxIhcJXg; spf=pass (google.com: domain of linux-kernel+bounces-18228-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18228-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1270E1F272A9 for ; Fri, 5 Jan 2024 18:35:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7182435EE4; Fri, 5 Jan 2024 18:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="hxIhcJXg" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32E22347B0 for ; Fri, 5 Jan 2024 18:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42839fe3478so9248611cf.0 for ; Fri, 05 Jan 2024 10:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1704479716; x=1705084516; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+fi0onpTGrV63R/StoJONU4NViJ6wCXVAQDgLv/SfZY=; b=hxIhcJXgek4kTcVU5r5+3CF9KqdBn/t/u6jPzsHHXdCK7jkTn8Knn97SZ2fEd644RA NIyZDsqY8mngkUqAzBkUUzBYouJK9DDlzRTpS996dSGsNIvMNmFNCA7HGlvNModSxU6h CmRN6dZKRCtWigNuVixZW+agv4HMEHZKFQbBx4yNyS0xxST6AvgKzIrdjEF7mXQIWjdP toygHEX7vDMQB821PAPOo8+xbokor2mQRlIFnrYnDtp6eu9un8hZS24QD9+htyV6oDFc HTsFfAPzDuShVyuvOLgIGA9LKrzrCDnhT755yYwQtcgO+jSDEmUWb1584XVyQgb26VCI LJpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704479716; x=1705084516; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+fi0onpTGrV63R/StoJONU4NViJ6wCXVAQDgLv/SfZY=; b=N9Wqii9A/Fn45cMZ+y+Q+ShTlXly1PLUoZ1ociU/hFQlmxrffv+sZr1QeGO4fKMgGr 8qJkn3JBcqMnOYHaPtxfLDpd8gvhHL2632sxtdDaIVWaXfmlff5ck8WaTlbVvrNiIpFu jRdoxAVDJTM799Vdilj6YWcldtCZXCHb4IQClXe8jB0bSUZtskvqHeouFQ5TtubY8kVp LlR7lNyXiKtYK+aNHcM9R8ttu87GUW1PUsHQ+GMNNl3b/b8ZHkiEKzQceTtr+lNbymRs iZMrgsFIk56EQVRxN7nTjt7Y12odivLYsAIHg5KQ7q6s0ME6VHxUJPNl9zkuwH8gw5aF 6wSQ== X-Gm-Message-State: AOJu0YxppDKGfVSosLyzDg/x0l4zGhyV1q9X8pjtucEeBp/pTO5JXyHr XJU9sXMu4lIQpbLRXO0ksN0LKK/UxqMoNZEy6vRw/CoaTkX9BQ== X-Received: by 2002:a05:622a:148d:b0:429:760d:64da with SMTP id t13-20020a05622a148d00b00429760d64damr1492011qtx.19.1704479716012; Fri, 05 Jan 2024 10:35:16 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231205223118.3575485-1-souravpanda@google.com> <20231205223118.3575485-2-souravpanda@google.com> In-Reply-To: <20231205223118.3575485-2-souravpanda@google.com> From: Pasha Tatashin Date: Fri, 5 Jan 2024 13:34:39 -0500 Message-ID: Subject: Re: [PATCH v6 1/1] mm: report per-page metadata information To: Sourav Panda Cc: corbet@lwn.net, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, muchun.song@linux.dev, rppt@kernel.org, david@redhat.com, rdunlap@infradead.org, chenlinxuan@uniontech.com, yang.yang29@zte.com.cn, tomas.mudrunka@gmail.com, bhelgaas@google.com, ivan@cloudflare.com, yosryahmed@google.com, hannes@cmpxchg.org, shakeelb@google.com, kirill.shutemov@linux.intel.com, wangkefeng.wang@huawei.com, adobriyan@gmail.com, vbabka@suse.cz, Liam.Howlett@oracle.com, surenb@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, weixugc@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 5, 2023 at 5:31=E2=80=AFPM Sourav Panda wrote: > > Adds two new per-node fields, namely nr_page_metadata and > nr_page_metadata_boot, to /sys/devices/system/node/nodeN/vmstat > and a global PageMetadata field to /proc/meminfo. This information can > be used by users to see how much memory is being used by per-page > metadata, which can vary depending on build configuration, machine > architecture, and system use. > > Per-page metadata is the amount of memory that Linux needs in order to > manage memory at the page granularity. The majority of such memory is > used by "struct page" and "page_ext" data structures. In contrast to > most other memory consumption statistics, per-page metadata might not > be included in MemTotal. For example, MemTotal does not include memblock > allocations but includes buddy allocations. In this patch, exported > field nr_page_metadata in /sys/devices/system/node/nodeN/vmstat would It is OK to have nr_page_metadata field in nodeN/vmstat based on this discussion: https://lore.kernel.org/linux-mm/CA+CK2bB2=3DraEP8W5GDW_JY7TDvwtSCbkQjvn=3D= SvbjUjPETXZow@mail.gmail.com > exclusively track buddy allocations while nr_page_metadata_boot would > exclusively track memblock allocations. Furthermore, PageMetadata in > /proc/meminfo would exclusively track buddy allocations allowing it to > be compared against MemTotal. > > This memory depends on build configurations, machine architectures, and > the way system is used: > > Build configuration may include extra fields into "struct page", > and enable / disable "page_ext" > Machine architecture defines base page sizes. For example 4K x86, > 8K SPARC, 64K ARM64 (optionally), etc. The per-page metadata > overhead is smaller on machines with larger page sizes. > System use can change per-page overhead by using vmemmap > optimizations with hugetlb pages, and emulated pmem devdax pages. > Also, boot parameters can determine whether page_ext is needed > to be allocated. This memory can be part of MemTotal or be outside > MemTotal depending on whether the memory was hot-plugged, booted with, > or hugetlb memory was returned back to the system. > > Suggested-by: Pasha Tatashin > Signed-off-by: Sourav Panda Reviewed-by: Pasha Tatashin Pasha