From patchwork Thu Aug 8 15:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13757858 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 E188DC52D7B for ; Thu, 8 Aug 2024 15:42:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3209A6B00FB; Thu, 8 Aug 2024 11:42:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 281366B00FC; Thu, 8 Aug 2024 11:42:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1226F6B00FD; Thu, 8 Aug 2024 11:42:47 -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 DF0866B00FB for ; Thu, 8 Aug 2024 11:42:46 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 83B5EC14D5 for ; Thu, 8 Aug 2024 15:42:46 +0000 (UTC) X-FDA: 82429495932.24.BC84965 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by imf30.hostedemail.com (Postfix) with ESMTP id B030080029 for ; Thu, 8 Aug 2024 15:42:44 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=zhhJm12o; spf=pass (imf30.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=1723131699; 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=JDFp22AQxyyflK1t03n9dVCi8P6WDfRZ5X/KyWOrQIc=; b=MdCnZFwDdL39nZHGgLtIqzvn0WOPEtIsf6dmzIqEJU6oC2WgfW3N7WmEtKZF0TWbOItDq9 YgEe4/gqIxS2UvknaqbD3whIDawFu1IIApQTl6ZjmpjMJW/kBcAeZ6v5vk5v8vr8/4dRx0 QrzZWEbyaJNPv/IfW7mcRaOjppUFhYg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723131699; a=rsa-sha256; cv=none; b=z0JDgl9MWAbqAarShOo0Mpgy76NLFqnDF6/AFNnX9q6vp1vFAsHeWA3OUFrwVOTq6mo7Ok nAnPouPppthjYcFbTXKOmssD1Ni1LCUzkf8kqwn3EXTGjD7KNOuD0F3/4X9YkHaiSFccz3 TwUCmyHTVrXiPFHZJTLH3jVxz8bNP9g= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=zhhJm12o; spf=pass (imf30.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 Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6b7acf213a3so6065126d6.1 for ; Thu, 08 Aug 2024 08:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723131764; x=1723736564; 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=JDFp22AQxyyflK1t03n9dVCi8P6WDfRZ5X/KyWOrQIc=; b=zhhJm12oGZtemEv/W+4N2tVaWgASwuRCieax8GuTNbWs1wz3ssX4JCc8ULGBFFKI3v pVAg81cem9MEGYDHEmSedxgMpYQMqOkdbwckqyt3mXo846JqYAe+JOyH0rYmMSkjs+mY WGdGSNxwbaIlM5Ef7AOrhVrxn/5o0ZSqaW74Jm6twZ7Fg2QyMDt/wyFo3wfEsBHZOrQy FwHtA8OxyZ4TqkUobAfXdSDLnzpFRKti0QsIGXw20OBaYtrymSTjmEhMvBMa+wbjCr0P DYGdB49iYgJ/mWjMH0wf0WCFDJsAJ7ITyQ6U8WrnCxIOD4iU0UwsID3acTiEC2Y4DqOF +mJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723131764; x=1723736564; 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=JDFp22AQxyyflK1t03n9dVCi8P6WDfRZ5X/KyWOrQIc=; b=d1w0I1cG+9z/0sEgsicepUdcfBQhBkbXrUUfkMjktmnG0GjM/Ee0vnsXbWP5IKjEeh SH6oGY23+XHXZVLa/7I4ERfGvgD3jb0IqSrA1ZISKZ3PetHQyVzTmM1cgVJklwn2TvOc AHSAqgeTroU5jfsPc7DFpbp/qkjRjo1ZwX3Cp9ePnl/M81cvl++LrgydU4NbCKj8zceS q9WOp9pvpFvE0DhnReP1TUwtPgzJ8Os9vTiINcQhK2WbGopq5SIIXT+Lh8VIC5iXUvIe n+aOftltKwtlYVh0+NVNwsMHFh8oTd19YbAs4MWGfqc1dD2djX5iF/unzlE03ZtOA/xs Avng== X-Forwarded-Encrypted: i=1; AJvYcCW6jZaV73Nf0TxmI4/IPVw1xTfl2//lJuQG6TR91PBsavYduNrqJH1C3q3Ab0NFx7uZqKZUHtEwRbIbnD0TqW6Uxrs= X-Gm-Message-State: AOJu0Yws7oHPGexpzynCi1nOBTlmjeJbO2GgamfUKVccDwhPM5sJTELc 5Fkgnyp+gylOsKmc4Vcp4jXmFqkqQmsm88zEA7EX4P0r+uiGHSN8az+PnTYnStI= X-Google-Smtp-Source: AGHT+IEX9KsTxhX/Ixnu+CrH4K+4EL15weClfV8tgGdVgFqf5/zGrOX8N7XKxkOKw/LPNvKUtrOSaQ== X-Received: by 2002:a05:6214:5d0d:b0:6b5:7e09:970c with SMTP id 6a1803df08f44-6bd6bd227f2mr22276276d6.33.1723131763822; Thu, 08 Aug 2024 08:42:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:42:42 -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 3/4] mm: add system wide stats items category Date: Thu, 8 Aug 2024 15:42:36 +0000 Message-ID: <20240808154237.220029-4-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-Stat-Signature: iirmew5opyhrqnn8dxu3kw9jw8jbciwa X-Rspamd-Queue-Id: B030080029 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1723131764-104574 X-HE-Meta: U2Fsd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rki4Jgw0/+mRxpECC4iaxXNBPys5UC6PR5dKLzvo3TsYhBmV8QWp1W8XzCoexkmOaH99uAVngGwoOywU4WZkGnv3OwyUDivGAgRDHsCH7Epm+LmfhRLiBnmj2DjNF82rVVmaoRJUw7t+PimeGcl3fmmo5RxDyF5KxKCcsPsyxz2qgfuW/kLUDoY+nthI6hDB+BdUpfxbSZDeffx+65vwI/VzTzYD9Wg1Pol2oZQFMIS7iju6PBcZMnH4dEzHbOD7Yirrt/ayh+RA8uIgtero8Aw5M6Cc58VTACLM7yX4RM/+di6yD9awR7RMU= 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 srhink. 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 --- 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);