From patchwork Sat Sep 28 02:16:19 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: 13814602 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 C4CFECF6494 for ; Sat, 28 Sep 2024 02:16:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 291BB6B0169; Fri, 27 Sep 2024 22:16:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EAC76B016A; Fri, 27 Sep 2024 22:16:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1C316B016C; Fri, 27 Sep 2024 22:16:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BA8326B0169 for ; Fri, 27 Sep 2024 22:16:33 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 70D6916103E for ; Sat, 28 Sep 2024 02:16:33 +0000 (UTC) X-FDA: 82612533066.02.07047AD Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by imf04.hostedemail.com (Postfix) with ESMTP id 4854740002 for ; Sat, 28 Sep 2024 02:16:31 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=KbfWfQKM; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.13 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727489691; a=rsa-sha256; cv=none; b=jTk0UfVuORSOPZCfo46e62i5H2UYI5l5k23ossm8V7p3zxE2M3JMTUTXKQ9uujqug87a79 aLO/QxVPkHIqHLYma8/0yDr6AjQgzW4n6NIgSlHrLtcN9numvEjhgcgblvPhPhd/PYv1cv jO4bcg1hQ5BvkNkqKikmZnw7r/WxvQI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=KbfWfQKM; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.13 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=1727489691; 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=CgshABXh43+EnL8gofqo/XDlvuefRSD0JDpM1evDmPU=; b=ETGwWGNm3zF90hTf8FQwHpBxM1v1qS+SJIqRS+ODz7xiVYaEv8aeHj7G3Z96U166/UE2ZZ agpva4jYLz3IfsdToyH6n+6pszjoMXdPNRNSIgyel8IbwOGi6CEnGAgR9T2IUsmaFgosIB osPL0jYzatQ6AfqGNOCXefhLOpLZVnM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727489791; x=1759025791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6AckfW5DPm7esIMMaP5o1qk+OTB0aCm1cTjPckojN8M=; b=KbfWfQKMkFylo8gV+Qg7kuJvh9+iMrxP0zilWbi711paxNsHIG4h0HVk NmbY26rb5gamhv/mvba4ju2Pk9XP0A2g49OMWSbb+XukZfbw8x9/AAmVx NCN8U52Tau6F6IoUnOf7N9KI5mUDQH0ij/IcAEB9Y5KEJE9GoV5GpsRON VAjuy/oCEJNiSPvCbzxkU8bmK5MOHuruwHCPYj6C2nZXWZCYLkDO1+AmK 6srMv1jN6pJGUreUy0rrdU2PG9q+aOZhSQW9qZODXSIXwHf5jTFUmqFhW L3CWn7DsGS1U+HA5r2W2Rh3UF4YwB0owWB7RJda/IywZk68XnqcX25CzW g==; X-CSE-ConnectionGUID: iUlMrqfuRJCyayOqqnftTw== X-CSE-MsgGUID: AJHh9Y9dS4uUf36Hy+2H8A== X-IronPort-AV: E=McAfee;i="6700,10204,11208"; a="29526911" X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="29526911" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2024 19:16:21 -0700 X-CSE-ConnectionGUID: 7310gMP3QtWHwY/v2lB2jA== X-CSE-MsgGUID: A0YqRezoS0+mYDf5q/jI8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="73507133" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa008.jf.intel.com with ESMTP; 27 Sep 2024 19:16: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, chengming.zhou@linux.dev, usamaarif642@gmail.com, shakeel.butt@linux.dev, 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 v8 7/8] mm: swap: Count successful large folio zswap stores in hugepage zswpout stats. Date: Fri, 27 Sep 2024 19:16:19 -0700 Message-Id: <20240928021620.8369-8-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240928021620.8369-1-kanchana.p.sridhar@intel.com> References: <20240928021620.8369-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4854740002 X-Stat-Signature: 6otcrywtdcz6ne4tb7g6xf3mer8rywp8 X-Rspam-User: X-HE-Tag: 1727489791-939589 X-HE-Meta: U2FsdGVkX1/XRurBD3iKD/9QS8kql36MTOmZc0XhYN/XCnS5I2rMycG4Qp8DY0EKblZ46eda78ISe+sGsRFgfjzPqpiL1EIQBktiAfzhbGTLmCOl9nS5xTOWmDZ4ZGRISMF/yt/LIzWFsJUVp3xYWTzDIayXfx27NppIE7DRsetrcdNVD+jo/S0vs1tdo3D4+g4k+9R1NxBoNKNALMm9uWM3GZpfyupA5am33Sn6nYslrK7k5/HNvK/XP77MPNRTwmPgH/7vQLdZ5d0UAnUd+OtleWXiDXxirjYF9VGOkl/7Wbipf2bF8gEPpB881EPupoCJ8CMLOkPn42TcaQPC3ogGCPio7mdkdDBd0Yo3pXYFOnL4u/ASr2CK1jvy/WvzQ/p1p7r9yAtvRWCCYmnIWEQP8YBhL9NX+RzpXkkcF1Llxsfvdlqew0iFJKiSSLn4rbk69h29gX5A0RJw5y3oVL+trtBCmf7aGGBUSXCJarbnbXF+zyMyg8PgdppEadafZifxEP+NNWog+eKs1auOSiit8Lyt93O5PlIaJA2vsZBJLAJ4KMaBLpiaH3pcTE9oNA2d3yw7vc1Nimeu8xnsDolSJWs9Er7gfsJ9vpff691Kzl3XcnVzHs/XkbqKIAQYPrewg3dOzig7P3Z5eDQd3miHtVA2K44juk1QXA1HPUeqszMWuhpqxfyNOeac2T/Usrl+3pIwo+0Hlv9C2cRAHyie03N45/Z8yp5MXoaSYIXehxY6TlURoT7Ofg8CwCpaAKzVbWBawXME+CeAaTB0N6nm0vB5I55dgUtCo0HtGZmWACID9TGR+XITe6Mjo3TfcHi3k2Llzo4j5YR7HxQZt6B3w5N0BaG78qnCGXe+brCQcPlcJ0Hajnqv54eJuCiVK61DnFRRQRu6piGWvFdJkk933Vu29+NC648evJjahCLy7ubPdE4pXLyELcJHaO7M3fjagZS8d6giwL94HKv /PKKnlJp cZZV4qUMlG/PAAsITUxxSWyBETrVAFPXqoAdw5P6J/CVHsk4Ip72SqhcCtdIqs5tCoHvMlPEpqe8GqLsXmOyV/LXpKu5vCIF3q3d5QAwa/DWnNd9/rJc2ZW3X+RRaPZF5vczU9V8f31ywcI+2p/iJ69Gsn8BgVNMnzvLg3SYG1/dEd/EaMB7s1w77bQ== 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 a new MTHP_STAT_ZSWPOUT entry to the sysfs transparent_hugepage stats so that successful large folio zswap stores can be accounted under the per-order sysfs "zswpout" stats: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpout Other non-zswap swap device 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 --- include/linux/huge_mm.h | 1 + mm/huge_memory.c | 3 +++ mm/page_io.c | 1 + 3 files changed, 5 insertions(+) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 5eb4b0376c7d..3eca60f3d512 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -119,6 +119,7 @@ enum mthp_stat_item { MTHP_STAT_ANON_FAULT_ALLOC, MTHP_STAT_ANON_FAULT_FALLBACK, MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE, + MTHP_STAT_ZSWPOUT, MTHP_STAT_SWPOUT, MTHP_STAT_SWPOUT_FALLBACK, MTHP_STAT_SHMEM_ALLOC, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 13bf59b84075..f596f57a3a90 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -611,6 +611,7 @@ static struct kobj_attribute _name##_attr = __ATTR_RO(_name) DEFINE_MTHP_STAT_ATTR(anon_fault_alloc, MTHP_STAT_ANON_FAULT_ALLOC); DEFINE_MTHP_STAT_ATTR(anon_fault_fallback, MTHP_STAT_ANON_FAULT_FALLBACK); DEFINE_MTHP_STAT_ATTR(anon_fault_fallback_charge, MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE); +DEFINE_MTHP_STAT_ATTR(zswpout, MTHP_STAT_ZSWPOUT); DEFINE_MTHP_STAT_ATTR(swpout, MTHP_STAT_SWPOUT); DEFINE_MTHP_STAT_ATTR(swpout_fallback, MTHP_STAT_SWPOUT_FALLBACK); #ifdef CONFIG_SHMEM @@ -629,6 +630,7 @@ static struct attribute *anon_stats_attrs[] = { &anon_fault_fallback_attr.attr, &anon_fault_fallback_charge_attr.attr, #ifndef CONFIG_SHMEM + &zswpout_attr.attr, &swpout_attr.attr, &swpout_fallback_attr.attr, #endif @@ -659,6 +661,7 @@ static struct attribute_group file_stats_attr_grp = { static struct attribute *any_stats_attrs[] = { #ifdef CONFIG_SHMEM + &zswpout_attr.attr, &swpout_attr.attr, &swpout_fallback_attr.attr, #endif diff --git a/mm/page_io.c b/mm/page_io.c index bc1183299a7d..4aa34862676f 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -269,6 +269,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) swap_zeromap_folio_clear(folio); } if (zswap_store(folio)) { + count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT); folio_unlock(folio); return 0; }