From patchwork Thu Aug 8 21:34: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: 13758206 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 309B3C52D7B for ; Thu, 8 Aug 2024 21:34:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BBF06B0095; Thu, 8 Aug 2024 17:34:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 645336B0098; Thu, 8 Aug 2024 17:34:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BE3D6B009A; Thu, 8 Aug 2024 17:34:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2FE106B0095 for ; Thu, 8 Aug 2024 17:34:44 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B6E2D40155 for ; Thu, 8 Aug 2024 21:34:43 +0000 (UTC) X-FDA: 82430382846.29.531EAA7 Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) by imf28.hostedemail.com (Postfix) with ESMTP id F2A08C000A for ; Thu, 8 Aug 2024 21:34:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b="gnIvU/Vq"; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.54 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=1723152816; 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=+YmoLJUzKwh05YDZkUnFH4Q03LnbmDmhfqr83K75cyk=; b=661Szh9dpTT4Bt0dK6cI5heRA6oel3DhCSVm8vSPyGw4XxkIcT87r2T0WMK5Mp5IuCR/8j R/2TauMocMhWb1dDrwKEosvXjQrP8v0AOoXlVGdA7Lun3lklKicOWt9OhuCNSGWIcu7oSd +GSOGeYndiC/NwEKD9Lw0lSjdlcMz4c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723152816; a=rsa-sha256; cv=none; b=5cN0jQUMXzRfF7UKMX3kj6KnYjo10PqBS30bU43NAxwkG4N6e+8jN96NJP0YZvh601jptc w7X0odd8Ur6wIo0Zz5OHUbvSCJEx05dkdgH5ym4CCwYsd9uSiWyVaSPFCr96GEYuv25ylN 8P/wDrzWDjBXM4McJjpL34FxmjGzthY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b="gnIvU/Vq"; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.54 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-831a5b7d250so494210241.3 for ; Thu, 08 Aug 2024 14:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723152881; x=1723757681; 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=+YmoLJUzKwh05YDZkUnFH4Q03LnbmDmhfqr83K75cyk=; b=gnIvU/Vq0kgZuJimynIF6ky9WjwUxv6P3msvCjlyw3bqc+w96a7nVXyZYBxIfUStmj +LcRO2USoNHXQbxg6ru2F8dbfMvgJp+ASPE14WIzx8f2a8pFBNbe5/NL5gkWNQGfnp/1 ssvGVtp27InGkjMhI57xP9GPhaHbWcJKBIp4OUQFYWk1kJjfBMeVqJ55/Lmk1y1Rx5MY Dc7A0RpB7nnRUTxlbWSDMqBN7x+lRK/B6sUDOyx2nuK1eQikvgDBZTJ/FoG9nTO4w9TN PkH5wGc+n4CoCUqvx28BvjG9Vyg3yUFa50WVm7l/Gbp3bTBm5WfyO5SICVeMahgbDh5V 33cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723152881; x=1723757681; 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=+YmoLJUzKwh05YDZkUnFH4Q03LnbmDmhfqr83K75cyk=; b=jxvraQvQqGq/G2SGwqFmgCr5BjBEQ8mH3RGO6tFXj1XvmCWcwrGWr3SYVOC5ZqIKLy OkXKBmXNKF/dMlnzxgm+mDrs6udXVOYO5Tib4w64cvPc2LwtQE5pR4bbkt3nCIDtFah2 KokJcoCuOiCiuKTTHoAc7UBvev/H9bIX3YTT72b2oArzJ4yD8mSfNrP9IBlBLAWLKaW2 q9uAGC3oZZcchQPXIspMMQcS+x3ndx4w32mHSvIhE3jPpa3GQ1mbkBpR+ywXXw97Epwd Dl1+vp2Ly/yaPq7eZBgWuW/NSmslcACdQ2bivlyVZkSzZ+Dg1hGOtDzkyt2cinSr6Xd8 DDkA== X-Forwarded-Encrypted: i=1; AJvYcCVTlSmVC1zS9LJTlQAQ+t3BLo6ia2q0nOl/cK+9z+oV4NKcYU/bfcpb1byEDQ0p5Uzr/d1vBViDp1kOriBt3kUBmVk= X-Gm-Message-State: AOJu0YyqSnFOGjKJOifcOIQ34KhI/I7qH25+95dq0/LxajS0TaGfQz9U 4OzEQqusq1FezBcemvWnMk2LXUyl86/P4OiYHUEBb1nmGQib1NyO6YhzlXWpogU= X-Google-Smtp-Source: AGHT+IE4Qv1sn/qov17GIXusF8ykKagazq0LzzEpnGG7EXiIsWLtpNSrGNRu3rLDOXEBkRSnwDDAyA== X-Received: by 2002:a05:6102:2acb:b0:492:ab05:8d6e with SMTP id ada2fe7eead31-495c5b38e89mr3764112137.3.1723152880951; 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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 14:34:40 -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 2/3] mm: add system wide stats items category Date: Thu, 8 Aug 2024 21:34:35 +0000 Message-ID: <20240808213437.682006-3-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F2A08C000A X-Stat-Signature: ibswu3ca979kyr539frknhd91cg9cect X-HE-Tag: 1723152881-391378 X-HE-Meta: U2FsdGVkX1+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GF1GMQLI1LAqe3Fc2rRvF9dgRoCY1v8fCs01FFFJZ7FM97Q1swbZHf+hec9CPSnrDfO7iQKVzBgYSS2igO7T/d8mb5R/tYwDaNVz2XXOk7wqw/SSxq0P86/4o5zcWF72hxHH4fegeVgUP7d5ne1T2L6nSDwbY/Q0TFfrFPPS3yGrFs0OysTzyqZlvsk97pEOcnLB4SecEmsYD7mH0nauZK5cwpi9tWvuAgV/VwWdILhHQbDJBTEhgs5JwbVq9NlEtY3lQDAWKGTkA7ZRp3pEVcy6uhM4cOnN6WITjCv0= 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: /proc/vmstat contains events and stats, events can only grow, but stats can grow and shrink. vmstat has the following: ------------------------- NR_VM_ZONE_STAT_ITEMS: per-zone stats NR_VM_NUMA_EVENT_ITEMS: per-numa events NR_VM_NODE_STAT_ITEMS: per-numa stats NR_VM_WRITEBACK_STAT_ITEMS: system-wide background-writeback and dirty-throttling tresholds. NR_VM_EVENT_ITEMS: system-wide events ------------------------- Rename NR_VM_WRITEBACK_STAT_ITEMS to NR_VM_STAT_ITEMS, to track the system-wide stats, we are going to add per-page metadata stats to this category in the next patch. Also delete unused writeback_stat_name() function. Suggested-by: Yosry Ahmed Signed-off-by: Pasha Tatashin Acked-by: David Hildenbrand --- include/linux/vmstat.h | 15 ++++----------- mm/vmstat.c | 6 +++--- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 23cd17942036..9ab4fa5e09b5 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -34,10 +34,11 @@ struct reclaim_stat { unsigned nr_lazyfree_fail; }; -enum writeback_stat_item { +/* Stat data for system wide items */ +enum vm_stat_item { NR_DIRTY_THRESHOLD, NR_DIRTY_BG_THRESHOLD, - NR_VM_WRITEBACK_STAT_ITEMS, + NR_VM_STAT_ITEMS, }; #ifdef CONFIG_VM_EVENT_COUNTERS @@ -514,21 +515,13 @@ static inline const char *lru_list_name(enum lru_list lru) return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" } -static inline const char *writeback_stat_name(enum writeback_stat_item item) -{ - return vmstat_text[NR_VM_ZONE_STAT_ITEMS + - NR_VM_NUMA_EVENT_ITEMS + - NR_VM_NODE_STAT_ITEMS + - item]; -} - #if defined(CONFIG_VM_EVENT_COUNTERS) || defined(CONFIG_MEMCG) static inline const char *vm_event_name(enum vm_event_item item) { return vmstat_text[NR_VM_ZONE_STAT_ITEMS + NR_VM_NUMA_EVENT_ITEMS + NR_VM_NODE_STAT_ITEMS + - NR_VM_WRITEBACK_STAT_ITEMS + + NR_VM_STAT_ITEMS + item]; } #endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ diff --git a/mm/vmstat.c b/mm/vmstat.c index 04a1cb6cc636..6f8aa4766f16 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1257,7 +1257,7 @@ const char * const vmstat_text[] = { "pgdemote_khugepaged", "nr_memmap", "nr_memmap_boot", - /* enum writeback_stat_item counters */ + /* system-wide enum vm_stat_item counters */ "nr_dirty_threshold", "nr_dirty_background_threshold", @@ -1790,7 +1790,7 @@ static const struct seq_operations zoneinfo_op = { #define NR_VMSTAT_ITEMS (NR_VM_ZONE_STAT_ITEMS + \ NR_VM_NUMA_EVENT_ITEMS + \ NR_VM_NODE_STAT_ITEMS + \ - NR_VM_WRITEBACK_STAT_ITEMS + \ + NR_VM_STAT_ITEMS + \ (IS_ENABLED(CONFIG_VM_EVENT_COUNTERS) ? \ NR_VM_EVENT_ITEMS : 0)) @@ -1827,7 +1827,7 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos) global_dirty_limits(v + NR_DIRTY_BG_THRESHOLD, v + NR_DIRTY_THRESHOLD); - v += NR_VM_WRITEBACK_STAT_ITEMS; + v += NR_VM_STAT_ITEMS; #ifdef CONFIG_VM_EVENT_COUNTERS all_vm_events(v);