From patchwork Fri Aug 16 05:48:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sridhar, Kanchana P" X-Patchwork-Id: 13765458 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 1EBC9C531DF for ; Fri, 16 Aug 2024 05:48:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E27A8D004E; Fri, 16 Aug 2024 01:48:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 11DA48D002B; Fri, 16 Aug 2024 01:48:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8BF58D004F; Fri, 16 Aug 2024 01:48:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B7F9B8D002B for ; Fri, 16 Aug 2024 01:48:17 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7A0FFA18E9 for ; Fri, 16 Aug 2024 05:48:17 +0000 (UTC) X-FDA: 82457028234.11.9E52D37 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by imf25.hostedemail.com (Postfix) with ESMTP id 68226A0002 for ; Fri, 16 Aug 2024 05:48:15 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=HGRPTu1O; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf25.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723787241; a=rsa-sha256; cv=none; b=IEo096JKziXiM7TAg+Ysfxum32sp07ooZPwtTag8/q7YudXrlKvSIBvzqR3Mit3Rb/WYfP uDE7Ik8tZeYlR2E9jfx5cczY8/+1j1riWHKMnLppE7JSCvwqOpV5245yA+eIc7MCx6krL+ RM9a43QGnpuIesFI2XN6RweW1VrO9Jo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=HGRPTu1O; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf25.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723787241; 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=Hv0pZRH2O3uWuKJq4mHJ3ytAE+yKARc7SzdSBN4A/oo=; b=LAQ+7n9C3ASRaJotr5qFywYuDr8/562Yblz75VhZm2YIih7wLAa7dcg9K4wbaANQbXqc/N lmVrgvNPeEWgI0oACqUVY9LCRdZbWqANAO+e9PT/n872xCg/wBXWA6sK2L2CpzKUwIsfsD l8S2HU2XZOWNsFXQi+dmY/xEgICiVbc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723787295; x=1755323295; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pIv8/Aymq35M3mk+Ip2dqi+IlPE8wYobMr4oum9ku1Y=; b=HGRPTu1Oe8QrImszGskbcntKH3eUgH5j5FHB3Bh7fm+OtSNyDLvMO/JL Ig70JGySp24c+KZ5Ubv/Vcc1TmwZbM1nbr8F6PFX+n/PoQpEhCXduAOeT fuMSOCfA9fKdwRwB2OeYfrAOK1LQzpLk5BrzOT988Wh224DLf+Xv79b/X +FAF80a/gLF0DsDCIKQ+dqN4za71JmEu+ORo+ISEZmgjo5/qBA1AjLJot M25rNfLj6kC/FFchNpC4yX7S4KZ7cpxHkWYMmmURrhW7ia/QFQpPCGIlY rvQJBMPr1xWSUgauqrcA0c/Z7Rtuwgys1QFMwRTyv6f6Z8fshKvBbO9j1 A==; X-CSE-ConnectionGUID: 6OCj4NYlTNG/+9XY+1ILpg== X-CSE-MsgGUID: JNxzGQ/3RRK7VPQ+x22ehA== X-IronPort-AV: E=McAfee;i="6700,10204,11165"; a="32648137" X-IronPort-AV: E=Sophos;i="6.10,150,1719903600"; d="scan'208";a="32648137" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2024 22:48:07 -0700 X-CSE-ConnectionGUID: Lw57TrXiShu8ilNs3A/XgQ== X-CSE-MsgGUID: YVfs9eGNSDGbKoVTja+gQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,150,1719903600"; d="scan'208";a="59415342" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa010.jf.intel.com with ESMTP; 15 Aug 2024 22:48:06 -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: [PATCH v2 4/4] mm: swap: Count successful mTHP ZSWAP stores in sysfs mTHP stats. Date: Thu, 15 Aug 2024 22:48:05 -0700 Message-Id: <20240816054805.5201-5-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240816054805.5201-1-kanchana.p.sridhar@intel.com> References: <20240816054805.5201-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 68226A0002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: co1r5yifengrnyw47xgx3p1mjjfpu7kg X-HE-Tag: 1723787295-179790 X-HE-Meta: U2FsdGVkX184NRxhve1piEYw0ykPAk+lScsNAVr6EFX0pBclyvj766fII6T6eWtm1SCAsjD7iOTC0zX9hRmlDvP/8XoxAjUltYAIjbkmW9MbRjnb5n5U6ovC8ukt9JoG2RhjY62YASrTtza5JedVAdDtlWbkbUYbCV5mutnjSoApcFwfL7DI9scVr9J8LVt8IjNZx+gA+jDKkA0KnpHPJlwgqCYB6HMMD6EvJD53ckc0Q1NR3w0HAgJRQEnxwpuyqew2Fu17fKf1W81TVPLyxTbvYmpe7vRgzO7wdbo0imM+SsRWrCw631/ns6MTs1P4RTXcnWj4HenBBbomO7SJylnc5U1O7YzkcVBxg7Evsu8KMpH3Gch5aqcCr3mLH2yzPxdKiTICieCkVRn3wIvW78R8wuoc/RKBdVcEbu+hNm8zPuvjVaxIHhBAF6cJ+yDuKYUgwVfB9k60NnWZDfPqV2I5hbFsYZ7ip9CgNTIojINfLOfYTMhwuRtEAGwDJIQyJe3CaDiRUK/stuUY3f6k3E4WXjQyUz4UIil3UrvfJ0WaqG66hDlcJte3IugSq8TegtOKp1WEqPwltxVZTlFcRPJOBzsunK67/92xPVoidpJKaGN+1Dyw/REgCpuOxBjjQsFi8GdGcsrCvGDMdWOYCDjuEHO/3WjkuisBbxU+m+nzFybCb2zPKKAUAEtw0xBY7nCu1WN3xFqGFOhNhdXeVI+nw6l/tazlc9eGKNWxgQl4m4mZpYpDSQ09o14U9KiAO4P/o+lQGH+GFXDwlfOy/IRP9zFgmXdUVIjCcf0Q1vEzMjLpyHV7DVIIgmEHI6t29q7z5dnNUxEzLWzVEJDjzyKe3gwDGLSrXDXT1lvpJquzxZnAyS0/5QLfXcfJgFhq+jUqkB19Wu9AJt9Lab9TAGe1qLRBkgCJLZv1lYTbmnQJJV73eDmVbOq34ExbfgYyxJ8Z5KUkK+r6jMTeAU8 8aPhOJMQ Nsc4aMKLAcuOaYLunfMSZqVFRro6VIpgyPXGgiyrRBbcwOUlBC2E4aWLkGfOEv0m2pSB0UYsL7bx8kWO+F9FQ8UBekvaILpnirLvOm8fJecWaOH9f/XuLuK/LNKDX3r8TPmGOyvlOC98Y2JHAUaNXQXn4og== 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: If zswap_store() successfully stores an mTHP, it will be counted under the per-order sysfs "zswpout" stats: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpout Other block dev/fs mTHP swap-out events will be counted under the existing sysfs "swpout" stats: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/swpout Signed-off-by: Kanchana P Sridhar --- mm/page_io.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/page_io.c b/mm/page_io.c index ff8c99ee3af7..debd04fbdfd0 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -172,6 +172,12 @@ int generic_swapfile_activate(struct swap_info_struct *sis, goto out; } +static inline void count_mthp_zswpout_vm_event(struct folio *folio) +{ + if (IS_ENABLED(CONFIG_THP_SWAP)) + count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT); +} + /* * We may have stale swap cache pages in memory: notice * them here and get rid of the unnecessary final write. @@ -196,6 +202,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) return ret; } if (zswap_store(folio)) { + count_mthp_zswpout_vm_event(folio); folio_unlock(folio); return 0; }