From patchwork Fri Oct 18 10:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13841576 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 36C62D2FFEC for ; Fri, 18 Oct 2024 10:50:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B49616B0095; Fri, 18 Oct 2024 06:50:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9E746B0098; Fri, 18 Oct 2024 06:50:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CADB6B0099; Fri, 18 Oct 2024 06:50:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6864B6B0095 for ; Fri, 18 Oct 2024 06:50:47 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3F66AA18CD for ; Fri, 18 Oct 2024 10:50:25 +0000 (UTC) X-FDA: 82686404766.02.AD0E3BA Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) by imf26.hostedemail.com (Postfix) with ESMTP id 3239614000B for ; Fri, 18 Oct 2024 10:50:37 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KWS/qCBC"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.217.52 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729248484; 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=BRHby0h+uR8HMvD4At3d64Ma8NriZDDBQPHvfHlsfXk=; b=fk6OGp3+Z1Wup+OLpuZ6uKGy+zHUuMviGsdj+6/iTPR8hIiZTi9wvwVllZi1dT1gZybbEe x9wdRTf9u+rYgqsLIce9glCJX3+AsaX0wUXJH3dJju1c2P6QZJn7gnL5MTwe/Ik+Relm4g gaEZtpdzqMneSgF3AzYX+qJxLVDUJzg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729248484; a=rsa-sha256; cv=none; b=zbLn3Pd57Fgn3EOsw/8dkbBg+kDFLohpQZFdkj+dUMDOptavyFvx6FIdZ9ujOiZdymEsRW S9/DyBgnoH6LoX4KkWXf/Ly4MmBYiL5boLBWnFoq+9AkPltJ5JVp3RjTqX8z6FA5oKUce7 gPoKV+uP5BWc4ggmXh3wp8XLZv9pgus= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KWS/qCBC"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.217.52 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4a5c4d8ee99so651558137.1 for ; Fri, 18 Oct 2024 03:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729248644; x=1729853444; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BRHby0h+uR8HMvD4At3d64Ma8NriZDDBQPHvfHlsfXk=; b=KWS/qCBCdNclE/xu49dXtOfrQvS0ITjd5ZZq1I58zv9n1v567j3B3OW30MF0vKGZqr yVIznX+ujtvUVxhifedIqoBfOnaeWUT5an/Q+Ae4BAGoDkJfdIfzAuwVCKBWAzMa8uA1 4vAp3/qmyfJt3zRVLbr2cUrYS1okd1T3kTBHZWTx/Vd7DhvTL5OTcEvyCNDltjDLKEdv 5K7LmQpNvAH4ZiA5NfwcPoDeAH0HsI8SYG2zI4CdFR7NRQIuiR9YR1qzKksv+9IH9GZH hyF20M7ktXMgpMz+AIrM3DusQrBJyazeCSFA3bs5f+pe5hD/dMf8hlAaPAjHZWXvxwHq lG8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729248644; x=1729853444; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BRHby0h+uR8HMvD4At3d64Ma8NriZDDBQPHvfHlsfXk=; b=HMthws11Y/jdbMqtukxUEnPTD/jJKZXtRwEeemtxe0tCIi/7wsCSS8clA6ZUnO/0Oa Y6HX7TCtOz4+dqEI1up1p4CG+AB2ZD2fdwOw/HxYU5losZVvzCYzOj8NjlOD3w938RRc tiub6FHqm6Fyg8yTRo9huarPgZXpu7FmluVf5Nqa/ja/fd+GCbggcJF5RsCmQTyZ7+o1 xoqaqExI0jPrpMSIbXwDcs361PbwcjyG5uH6H5J+SZfVlA3d5po6Ke6bssZkG4tosiMb ihhrXZp1etYfZLWA8NMUe7vxa4PTiRIzO01SOs9yHr9P49ovhr+TaW0P1Oyei7Z41Ko8 cspg== X-Forwarded-Encrypted: i=1; AJvYcCUBgZBHmQP8no/P1CrDk44wTcH6fVBQN57Qe8NUMpAdna+m3mLA2P9s4URA3S3jH6oQhr1BaAX1Bw==@kvack.org X-Gm-Message-State: AOJu0YyniRt+EknGzji4NsizNFSvu0REEv5rg82E7hBYDmNcK1zgQLga kHHL5S0d048r84RUGlyG5QTARsVfESGu0OP3gCysdBQd1eyzVtvm X-Google-Smtp-Source: AGHT+IHykbO3DzKF2g7UHtYVZ/jRuN9Qj89t9+anwaQLDnm38LEAsEEjNjDjKrfF3i0TApP/IeNGHg== X-Received: by 2002:a05:6102:d89:b0:4a4:7928:637c with SMTP id ada2fe7eead31-4a5d6aae56emr1935661137.8.1729248644408; Fri, 18 Oct 2024 03:50:44 -0700 (PDT) Received: from localhost (fwdproxy-ash-013.fbsv.net. [2a03:2880:20ff:d::face:b00c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b156fa81b7sm58410885a.68.2024.10.18.03.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 03:50:43 -0700 (PDT) From: Usama Arif To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: hannes@cmpxchg.org, david@redhat.com, willy@infradead.org, kanchana.p.sridhar@intel.com, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Usama Arif Subject: [RFC 4/4] mm/zswap: count successful large folio zswap loads Date: Fri, 18 Oct 2024 11:48:42 +0100 Message-ID: <20241018105026.2521366-5-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241018105026.2521366-1-usamaarif642@gmail.com> References: <20241018105026.2521366-1-usamaarif642@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3239614000B X-Stat-Signature: fwghtmck9gn1ks9dq45e7p5tmibe4qcp X-Rspam-User: X-HE-Tag: 1729248637-436543 X-HE-Meta: U2FsdGVkX1+u3TDUhkngb7L4Yd9McJ/QR9cnk0/eHHWB+7pXdWj+/2C4nBgOte4ehOzXYV4GJM31xO0IQuI1sGPGlRX+8bWkKJnUj9WZYo8aGOngzlFQjtYHtxptaotGgdjy3Tjr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SC4jnw4WPUIed3ajgow2PmyJjcVdnCu2wN7dNyiSP2Vze2Tx+w0l6qprbzRsA9EcO4ZchfSTSG6LHlEzwLxxFZnUrO9cHoPy680fSoiZK7ve2pMJ5h1L+FssY8nfp9xLZ+MBEi07qb+ZjarXubkQMSsu8MDRQj79Uda1I 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_ZSWPIN entry to the sysfs transparent_hugepage stats so that successful large folio zswap stores can be accounted under the per-order sysfs zswpin stats: /sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpin Signed-off-by: Usama Arif --- Documentation/admin-guide/mm/transhuge.rst | 3 +++ include/linux/huge_mm.h | 1 + mm/huge_memory.c | 3 +++ mm/page_io.c | 1 + 4 files changed, 8 insertions(+) diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index 2a171ed5206e..68a9790908b2 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -534,6 +534,9 @@ zswpout is incremented every time a huge page is swapped out to zswap in one piece without splitting. +zswpin + is incremented every time a huge page is swapped in from zswap. + swpout is incremented every time a huge page is swapped out to a non-zswap swap device in one piece without splitting. diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 3eca60f3d512..28a275d3107a 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -120,6 +120,7 @@ enum mthp_stat_item { MTHP_STAT_ANON_FAULT_FALLBACK, MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE, MTHP_STAT_ZSWPOUT, + MTHP_STAT_ZSWPIN, MTHP_STAT_SWPOUT, MTHP_STAT_SWPOUT_FALLBACK, MTHP_STAT_SHMEM_ALLOC, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a7b05f4c2a5e..587f7dd81500 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -612,6 +612,7 @@ 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(zswpin, MTHP_STAT_ZSWPIN); DEFINE_MTHP_STAT_ATTR(swpout, MTHP_STAT_SWPOUT); DEFINE_MTHP_STAT_ATTR(swpout_fallback, MTHP_STAT_SWPOUT_FALLBACK); #ifdef CONFIG_SHMEM @@ -631,6 +632,7 @@ static struct attribute *anon_stats_attrs[] = { &anon_fault_fallback_charge_attr.attr, #ifndef CONFIG_SHMEM &zswpout_attr.attr, + &zswpin_attr.attr, &swpout_attr.attr, &swpout_fallback_attr.attr, #endif @@ -662,6 +664,7 @@ static struct attribute_group file_stats_attr_grp = { static struct attribute *any_stats_attrs[] = { #ifdef CONFIG_SHMEM &zswpout_attr.attr, + &zswpin_attr.attr, &swpout_attr.attr, &swpout_fallback_attr.attr, #endif diff --git a/mm/page_io.c b/mm/page_io.c index 2a15b197968a..477f9d4fc009 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -620,6 +620,7 @@ void swap_read_folio(struct folio *folio, struct swap_iocb **plug) folio_unlock(folio); goto finish; } else if (zswap_load(folio)) { + count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPIN); folio_unlock(folio); goto finish; }