From patchwork Wed Aug 14 06:28:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchana P Sridhar X-Patchwork-Id: 13762876 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 13EF5C3DA4A for ; Wed, 14 Aug 2024 06:28:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 602526B0083; Wed, 14 Aug 2024 02:28:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B1936B0085; Wed, 14 Aug 2024 02:28:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 452466B0088; Wed, 14 Aug 2024 02:28:40 -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 258B46B0083 for ; Wed, 14 Aug 2024 02:28:40 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A9DE1A0CA5 for ; Wed, 14 Aug 2024 06:28:39 +0000 (UTC) X-FDA: 82449872358.28.783FEB0 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by imf23.hostedemail.com (Postfix) with ESMTP id 7711C140008 for ; Wed, 14 Aug 2024 06:28:37 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=UjqA8Pzi; spf=pass (imf23.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723616905; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GWQ26oeJqSObrMx2L85OU3m3MfCNX7McU5Oc1hPM3kQ=; b=m8dDcLo0hlPS9StNj6wK0L+BZWSQXw6XZ1wIdk/t0aTvFYxcH8E/5Y+EMtX4l9cSVwtoTC boWkjisfiUV4FaAPiTSHf3zsoFEWvw5G4IB7qIa+0nC+CZMIYPhtxpEiOPFfcO7BVTvXkF ANSZ9gI7iuTfxsAHLVhh/72mNZi9gvA= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=UjqA8Pzi; spf=pass (imf23.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723616905; a=rsa-sha256; cv=none; b=7AHt7gu7ljUA9ZQ3QYY0IcvqVvufJx4HA9lzqAV4vt2GNaQeLZ7MyupCLho+2wSPtRPjMM aB/2LfbuAGX5psPAlSBJ7IPq9tvgnerrHuFxbMseBAF5K5OKhdY/m5cHb4kESK/mcnyufO s59GHFoaF2PmGlTR1SAobT0lCrJMOsU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723616918; x=1755152918; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uqrNeGBRRJSKgfNeNGYme2bhngEOXyV0SlU+NTOqopU=; b=UjqA8Pzi/sMN4qT1mj5Fx+ZqyvBcd+Zz7hPPWu9eejI3EeH4jNDo5X1y IfOcpLPX64KvryrXCTDXQuSROHJZCnx7BSYHoaWKdWqKK5uxdqcdPjRaD frnmRdIB3VSLJ85zkIizOEgH72h9wxaS4DcoYlUDZWlTOkXiOmU4QTBX7 XbA/s9P71WFjyD/6H7t76Ga4GKWQhAekZBvYd6weQXVeVv00xPFA8lbfr tGOqpanrqba8mml9W3hmGK5v+QgWDwrXZ8/trKsdt+6efiUKMMGS40d8d q5SFqTaUZrgTbT1ejQ6IfqUfYnsAh9QVKzdZMRCplNX9hAcHBr4DBcfJP w==; X-CSE-ConnectionGUID: C2oUarP7TdedR3Te+oMyIQ== X-CSE-MsgGUID: FXAYNQX1TrqEvMeZH4iXoQ== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="44333008" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="44333008" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2024 23:28:33 -0700 X-CSE-ConnectionGUID: OhOjY6yjTM6kgTZgOGWk0w== X-CSE-MsgGUID: 0vYFo0pvQu2aqwWrMol5Rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="63568753" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by fmviesa004.fm.intel.com with ESMTP; 13 Aug 2024 23:28:32 -0700 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org Cc: nanhai.zou@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [RFC PATCH v1 2/4] mm: vmstat: Per mTHP-size zswap_store vmstat event counters. Date: Tue, 13 Aug 2024 23:28:28 -0700 Message-Id: <20240814062830.26833-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240814062830.26833-1-kanchana.p.sridhar@intel.com> References: <20240814062830.26833-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: eb7iy9efni4h7q9unjt7sjnhh5zw8ykp X-Rspamd-Queue-Id: 7711C140008 X-Rspamd-Server: rspam11 X-HE-Tag: 1723616917-834930 X-HE-Meta: U2FsdGVkX1/qS2MfEs0xlQJta9BKRCkoESC6LH9ak+EQdwAH1D4rI/yDwbpR8ntLLQkfLcHf+6c/B84SeVasBpVKG0NGGYrVc+fLc+wE1nzp6/DmQv3LkjS6gI/T72sy0kJuZpapxytOAhw92cP2+18AEvrCB+jRrncpbp8zkhy8s0/BvJICq67IDJTyJnKTTRgI2Qx9GZkPGyi7Ru+87CDPcmgrNaIUbXesKBqCmk3W5cA0Ae1aMlzDEctw+kTAwmbvNBB44pr3znWRgXr5VY2yqYj+NHHigwuPPtopcrvtTYTcnHN90//mZJGtKnhNrZAxhaQK6CQ1La4eYhcbtTcO5TXbOOsuGWMvXyR0vC9V1IPxnftG6fKjOnXXSeLyqz9EMl/+f3CNjCo7J9FsEJMgVt+/Sf5z33UE3mGlbRQCj+zApyz9EmzXdermpokiSkGPUjXORXuTp5cRmgV0oFPbqW89UoAnFFzjL3adGehg74kZKIS9JpuzQQMSKJ0tdkiYi4b9ZmpKKgai8uPtpubZGq7RRpTmPcAzT3SLntVBOuL0MFKAk+NwD+WsREC4mm+LgGRi5QWIq7GRk3Af3lCPR0mcyurdtnoV3g2HD4z6qW4+uBBNbcPEaaU5DNLOd+7vDHdHpPj/q6kjuH8NRdg4sg55v+z2HW7n7l+44I7o12q7E8Q96eSUYl5Ps7Dl1KuV0kwNODKZiCBHjKHAjO/aS0a9V9T3l/L45YnkYfBLjQejkUq2JEI4ucDYZHhOnIm6sBUGqHbpJzNpzc6RKdvKmf88/Lro6he45pQAjuvDoibXAq9EHJhXBCnotHNkK5XRNIEoBOFUBVBVS3cUGRD1mfG3Sf7xMRwugFbysr7a4j4FgNMOhRr6dhtWOU/jjSk2Iqt6Oj37B5fr+fQIB8ssF1ChiNYUD4EwUcM+FHo9izCqF7WjztujRiSrU7hiwFYo17neXc8KgMqNI33 8+0WX1lJ SXkKo8CLRGdVHQ2frWyn7J/HNLcaWl88+pUGmL8O96KIqE6C4z69TI1e4lNWD0BzMgQoTtKH9WPrRLWDaJ4oVctR8pbnfADI+qKntg/yWVhQoZM/ZKVzh3THnv0XBB3pwSvkjYIuiKLGT8MU7KBDju/P5nuPkD4/63oIbmk0DYNthB/6qPEJfvWKLaHV5ToF8SPKU87EBoraS2LU= 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: Added vmstat event counters per mTHP-size that can be used to account for folios of different sizes being successfully stored in ZSWAP. For this RFC, it is not clear if these zswpout counters should instead be added as part of the existing mTHP stats in /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats. The following is also a viable option, should it make better sense, for instance, as: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpout. If so, we would be able to distinguish between mTHP zswap and non-zswap swapouts through: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpout and /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/swpout respectively. Comments would be appreciated as to which approach is preferable. Signed-off-by: Kanchana P Sridhar --- include/linux/vm_event_item.h | 15 +++++++++++++++ mm/vmstat.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 747943bc8cc2..2451bcfcf05c 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -114,6 +114,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, THP_ZERO_PAGE_ALLOC, THP_ZERO_PAGE_ALLOC_FAILED, THP_SWPOUT, +#ifdef CONFIG_ZSWAP + ZSWPOUT_PMD_THP_FOLIO, +#endif THP_SWPOUT_FALLBACK, #endif #ifdef CONFIG_MEMORY_BALLOON @@ -143,6 +146,18 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, ZSWPIN, ZSWPOUT, ZSWPWB, + ZSWPOUT_4KB_FOLIO, +#ifdef CONFIG_THP_SWAP + mTHP_ZSWPOUT_8kB, + mTHP_ZSWPOUT_16kB, + mTHP_ZSWPOUT_32kB, + mTHP_ZSWPOUT_64kB, + mTHP_ZSWPOUT_128kB, + mTHP_ZSWPOUT_256kB, + mTHP_ZSWPOUT_512kB, + mTHP_ZSWPOUT_1024kB, + mTHP_ZSWPOUT_2048kB, +#endif #endif #ifdef CONFIG_X86 DIRECT_MAP_LEVEL2_SPLIT, diff --git a/mm/vmstat.c b/mm/vmstat.c index 8507c497218b..0e66c8b0c486 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1375,6 +1375,9 @@ const char * const vmstat_text[] = { "thp_zero_page_alloc", "thp_zero_page_alloc_failed", "thp_swpout", +#ifdef CONFIG_ZSWAP + "zswpout_pmd_thp_folio", +#endif "thp_swpout_fallback", #endif #ifdef CONFIG_MEMORY_BALLOON @@ -1405,6 +1408,18 @@ const char * const vmstat_text[] = { "zswpin", "zswpout", "zswpwb", + "zswpout_4kb_folio", +#ifdef CONFIG_THP_SWAP + "mthp_zswpout_8kb", + "mthp_zswpout_16kb", + "mthp_zswpout_32kb", + "mthp_zswpout_64kb", + "mthp_zswpout_128kb", + "mthp_zswpout_256kb", + "mthp_zswpout_512kb", + "mthp_zswpout_1024kb", + "mthp_zswpout_2048kb", +#endif #endif #ifdef CONFIG_X86 "direct_map_level2_splits",