From patchwork Fri Aug 9 19:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13759157 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 84B60C3DA4A for ; Fri, 9 Aug 2024 19:10:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 491876B0095; Fri, 9 Aug 2024 15:10:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A5A56B0098; Fri, 9 Aug 2024 15:10:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D00D6B009A; Fri, 9 Aug 2024 15:10:29 -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 F2C086B0095 for ; Fri, 9 Aug 2024 15:10:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B86311A13DD for ; Fri, 9 Aug 2024 19:10:28 +0000 (UTC) X-FDA: 82433648136.24.79497DC Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf28.hostedemail.com (Postfix) with ESMTP id E17BAC000F for ; Fri, 9 Aug 2024 19:10:26 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=ERGOn3wQ; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723230573; a=rsa-sha256; cv=none; b=BRtMy4ZJm/aNPVLgt94zSQupFuKSUtwGVXidTobhT0oLP79W4LSrHJKOEbLgHEoKYQfSS8 fwdny4UU/5BHVF+p1UpJpgWLSuBdJ140vI1581Dto+4rntx3Kb0XRyW2Ml8r8jKvu3H3lU NcL2GJADESHlhKOBP59JkypGcXpdnHY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=ERGOn3wQ; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.174 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=1723230573; 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=gDvms9T6MxTADOWyeqlGsrri9pz592+CY2RkeRJgrNo=; b=nk1Xa5gdnOto1KJClzJQnqcCBJ/T05jHQiFDdX2DScBQRU3SzGkkg48sVGc/x+p6WCro89 DZpUt9DiQf0zVHo0e1modGJqp7ixC5Kar0+/uQg3VgcZN99D+zVjsbu8As43zdfnaa6MtB nsazOTX+dlToY+EQhKbK+fK6dbYULCc= Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7a1d81dc0beso145990785a.2 for ; Fri, 09 Aug 2024 12:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723230626; x=1723835426; 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=gDvms9T6MxTADOWyeqlGsrri9pz592+CY2RkeRJgrNo=; b=ERGOn3wQPxU2mm7E2Pww9a7SvjwWDDL/xAmvJrjcy/e+gGnxbD6dnOMZVoN+Xwfoo3 1/DQrw+xM4evucZdOVaYgHb9usq6C7bPLK2eM1Znme4u+3l8AQOYKt0o12mv5IK0Pjpe URWr/olGMHC8pjflH15TCWhF+ip9KIqEfT4EHyrb4Aqk+AbM6R2ImK64HlVgp4sy5iKt jYvLzuL6O0pHlcWKgDBhEmvmPYJWwLeW+PDZ2FN3FF0oQ6ZxJz7T4+aybAIvTtWw+oLO N9aLOeZSiMZOVqKe4xPZhMGAg21lMo8ZWtA8FL0qq1KzPTeKzZSQaHrA0odMpxOeteos WKsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723230626; x=1723835426; 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=gDvms9T6MxTADOWyeqlGsrri9pz592+CY2RkeRJgrNo=; b=ntWPxA3asALONsiH6Xd8FZyfqCNWHADrGyQOmqNq2vzJUh6V+pw7yFXQ2zUfGmGCcb ABgSu1/TZLIX6WbBA0C5jkCDsf19fa+Snmew2Zq8SIsOVHbzh6gMW4plRgseoXCH3RAS F1/22tp3QZQRjFj6YUtxEdgW35KjxcRj2JMXYHE16B7XfxlkIm58ClhxNomyuQdbas5i Rc5FiGpZ3++WNgckSqUQgeKx8hMT/Xas4ST2YKZRAckuWWRvjXn18aeUO6T8hQhXexhz pbOn4W6GSDsOtt0BxlNvfAZ8S2DuCGesw87VSVo50XFCajVKJwxd2RtP+WQqRYk0WJ47 Azpw== X-Forwarded-Encrypted: i=1; AJvYcCV2nmdoKjVWIo/ggJaNWtYL8gfStk6hOdoR0XiUvV7Iz0b7b8um+DPeDiHvaUtrE1AKjy6mJDIHrFtye0AwRi1Am+o= X-Gm-Message-State: AOJu0YwbtkVqiz/e7Px0/oQrb1D7JYaT/e98f6WEP7lfi9+ubsI8vA9d vrWMK75eppWbTajJe0FjVwv52lbMSzqZdjuT3dNwfhbVIoMB1hpqPDwktXvkfFg= X-Google-Smtp-Source: AGHT+IFVg6UC1VsS2RarQnkmKfDpYYqkAoGLJP6WPhI6t59slYlLQRhsj/YpVmXHJEFlokfsL93xgA== X-Received: by 2002:a05:620a:2495:b0:79f:67b:4fdc with SMTP id af79cd13be357-7a4c1791fd1mr330555485a.2.1723230626022; Fri, 09 Aug 2024 12:10:26 -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 af79cd13be357-7a4c7df5a55sm5522085a.86.2024.08.09.12.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:10:25 -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 v5 2/3] mm: add system wide stats items category Date: Fri, 9 Aug 2024 19:10:19 +0000 Message-ID: <20240809191020.1142142-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog In-Reply-To: <20240809191020.1142142-1-pasha.tatashin@soleen.com> References: <20240809191020.1142142-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E17BAC000F X-Stat-Signature: nczbx5gx5hh3ab9ho17316e9ib6qgp5b X-Rspam-User: X-HE-Tag: 1723230626-415501 X-HE-Meta: U2FsdGVkX1+4pJE7ZjkYKPXOlHjtBuVVNS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eZv7IL5zsTtiO01e1zH6LHYMgqNzMi3D0HvkJA2iGQiUU1IQP4bEs+IwnIFSUF1TK6m6z0lXluRBENHxaAlTcXWSMGuzvYAMWMlQzwpoG3NQwMfhZPVUMlOtXGKmlCTJnAgImOvKmZ1RApYj2jaKc9reagVSb3IhCGhNKiLpLYqq6ZzUf4I6+ks99EgTdT1+CTgJdOr34kUAhKWm0ogNOh4b13JUCKGPSQfMrZEjg2qKRD0FYAlMuPqWdtQSWgQOoY52mW+pDJaRDKvxWl31urNeR2tYJRTWU 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 Acked-by: David Rientjes --- 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);