From patchwork Sat Aug 17 05:09:21 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: 13766987 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 ADA5CC531DE for ; Sat, 17 Aug 2024 05:09:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 904468D00C6; Sat, 17 Aug 2024 01:09:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88D9F8D00B8; Sat, 17 Aug 2024 01:09:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7302D8D00C6; Sat, 17 Aug 2024 01:09:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 526DD8D00B8 for ; Sat, 17 Aug 2024 01:09:36 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 07F18C04B7 for ; Sat, 17 Aug 2024 05:09:36 +0000 (UTC) X-FDA: 82460559552.15.A1E3A5A Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by imf24.hostedemail.com (Postfix) with ESMTP id EDC20180011 for ; Sat, 17 Aug 2024 05:09:33 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=IRMIC7t4; spf=pass (imf24.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.15 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=1723871336; a=rsa-sha256; cv=none; b=KJGeKUemR+pFZbSZVxjIDPgaFAR0vXnUJNCVLtMJV9NTsso6JJ8Rju5SrXXVISrYZ5Lw8s ot+e4Yrtf9Qnn5qQvSld+sgEMeEQpHX0QGjyNdY8xm8Miuj6wmPBkY/NTiJt8NuItnZRq9 jY8Hh6FyTpeVutdV8g5wdzm7pZYFW3o= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=IRMIC7t4; spf=pass (imf24.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.15 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=1723871336; 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=QvuJ+l8/8kHKkiPYqgt7vxwg2Gt1Upg6JAtT10bzj1vxlYBoo4ir+YWRKrlb2lNwPFRhJc VWpq9vyCrxNLHwKts6BicCl475Uzpfi6fH8uChmSuL218fo+AE1EmiaLcxj5NWkCJ0a6Ys 5o6/kNYCDIOnQlVykqTFOOYbhDp0NFE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723871374; x=1755407374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pIv8/Aymq35M3mk+Ip2dqi+IlPE8wYobMr4oum9ku1Y=; b=IRMIC7t49MfzNvoQj+3dSQ89Z9c8EjHVrrfFq0rQmKYwJsQ9JPtS5FW4 UL9Eo2cx8WuWG7aAQZSZplozbj42MRHPC13l2SDwH/RGIblUl5bzNM4CW Ahqo7mQztxTfOGEPNYWzq83zZhEQvX59nMWttiSPeF5kpQVPrt/K0sBsz cU+BhQgnDfcRB+reAcI0uQ3ryTghr6WGxBDdy+OOcaaUvDkclOyz49YsR epqOBFbVXOSi7qSgUrIx3tev1IAbdFrroOUU43akSyjGGm2auuOZubzUF nxd+Pv61DrHkVFO9Kcf9eF73mK1bwmRTlWZZtaPg9PrZM/5FqQJKrOvwO Q==; X-CSE-ConnectionGUID: XPnez9x6Sem/k15xRGmz0A== X-CSE-MsgGUID: W6GovgOXS/ujYMrEMdlKJA== X-IronPort-AV: E=McAfee;i="6700,10204,11166"; a="25929487" X-IronPort-AV: E=Sophos;i="6.10,154,1719903600"; d="scan'208";a="25929487" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2024 22:09:22 -0700 X-CSE-ConnectionGUID: G3ES7ewjRXi5YjsXLL3eQQ== X-CSE-MsgGUID: fZPmCcW6RFSDaGvIag7BFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,154,1719903600"; d="scan'208";a="60141501" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa006.jf.intel.com with ESMTP; 16 Aug 2024 22:09:22 -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 v3 4/4] mm: swap: Count successful mTHP ZSWAP stores in sysfs mTHP stats. Date: Fri, 16 Aug 2024 22:09:21 -0700 Message-Id: <20240817050921.18462-5-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240817050921.18462-1-kanchana.p.sridhar@intel.com> References: <20240817050921.18462-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Stat-Signature: cbksdfaejqu4dkado5y9mdbm31ogmkzr X-Rspamd-Queue-Id: EDC20180011 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1723871373-431488 X-HE-Meta: U2FsdGVkX1+ZF+VHXP+nHie+fh3ch0DPYoOvxh4RFw7JdlLVesctOCoOLTR/fi9N6kPMgXYfCYxxAZ6cC9zpWKLa6lyVZxLG4kyP0Y7ERI0dgcHS5gadEysZ6kH8KnF3y10d468H352LqghShjl/EnWPWksQBVJgDRQLW/Wf6alC6/JTPeDkSXMPXlZBnmn28uRT+rnBpjmXJPMVvcq4Rk4QDtE04LXONwmqkqTyLIhlVpN4b39T64SUGZgoGkPcRSLsogWui/hhQq4SV9qXkkMR3aM7aBLA1Q7ErY33qLeOt2QmEu9wMi0G9KoBf2dM+UcFPC8/2uO9U2ujZIOFltwv820Tym7Jv8JaXLi0lnfgbJGS2PPRzUxVxUnkrGJaCMdssssvEwaTOLVX4JNm3ufWkGYQN4LWtKvKvRYFFFoAAxGiB2QhAQ1wFeBv0oZ49C9+5Bilyh2gWvAaI4amP9f9xqg6eaJyevpHailwmRzFwwO7v9x4jaAUnTNMpKviNUzQodJu8IIFJiZyaw3z+wl0qxQZlDPmbBFq2ltRDlbOtYHQxwwCZ6tp55hNHhdkdDvAbW62eilX0tGGdGF22QsdTOUZowHxToz5esb7WxD2gjrewi59UfLwZcpdDolOXrbqXHPMCFnGJSyxE1XdM4kLKSIl6l3/Kyay9Djx5bkfglfv0YJ6FXTtMJeULva+mbGBka+1lr4v7wuAhnp+bsYspnT1vGGQZG/Py7hiavx1LBQwK8VwfQiWGPS+2WWZecF3oBn49l2KtdB7NXk/UUCUaxqE0hDqM7Pf4tft5rmNGwLIRreWr+ufLMMB7hyC+wDY4ynMDJlYQd4FeTCXmXfL8jAiZsvCtG8/JaYlxV32bx7mnoqmEaYJ/+2kpz36spytVPUvPZlFi118BrC+3AZT7xaNbdj31UsHeEV6bGXAOXiIZ1jB5jGyEFjcDC3k9x9j0Nsc6kKUUCfmc3X EEPSTtjF 90KHPYBprPkgMkcoLshcx24x4kwnvHjaw4NmQ/lXCiROkrc90sJxqkW5/U1yaSlnUNs+rPdhmlKeVmKdFg3qqH3aC3GfSvtOt9CkV9dPzjVJaYewCukXCz32oKILSzLQRZL2WYBTjhgyf0zp42vqVAgPAcw== 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; }