All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, yosryahmed@google.com,
	vitaly.wool@konsulko.com, sjenning@redhat.com,
	shakeelb@google.com, roman.gushchin@linux.dev,
	muchun.song@linux.dev, mhocko@kernel.org, hannes@cmpxchg.org,
	ddstreet@ieee.org, cerasuolodomenico@gmail.com,
	nphamcs@gmail.com, akpm@linux-foundation.org
Subject: [to-be-updated] zswap-export-more-zswap-store-failure-stats.patch removed from -mm tree
Date: Wed, 25 Oct 2023 13:18:30 -0700	[thread overview]
Message-ID: <20231025201831.7AD35C433C7@smtp.kernel.org> (raw)


The quilt patch titled
     Subject: zswap: export more zswap store failure stats
has been removed from the -mm tree.  Its filename was
     zswap-export-more-zswap-store-failure-stats.patch

This patch was dropped because an updated version will be merged

------------------------------------------------------
From: Nhat Pham <nphamcs@gmail.com>
Subject: zswap: export more zswap store failure stats
Date: Mon, 23 Oct 2023 17:07:02 -0700

Since commit 42c06a0e8ebe ("mm: kill frontswap") we no longer have a
counter to tracks the number of zswap store failures.  This makes it hard
to investigate and monitor for zswap issues.

This patch adds a global and a per-cgroup zswap store failure counter,
as well as a dedicated debugfs counter for compression algorithm failure
(which can happen for e.g when random data are passed to zswap).

Link: https://lkml.kernel.org/r/20231024000702.1387130-1-nphamcs@gmail.com
Signed-off-by: Nhat Pham <nphamcs@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/vm_event_item.h |    1 +
 mm/memcontrol.c               |    1 +
 mm/vmstat.c                   |    1 +
 mm/zswap.c                    |   18 ++++++++++++++----
 4 files changed, 17 insertions(+), 4 deletions(-)

--- a/include/linux/vm_event_item.h~zswap-export-more-zswap-store-failure-stats
+++ a/include/linux/vm_event_item.h
@@ -145,6 +145,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS
 #ifdef CONFIG_ZSWAP
 		ZSWPIN,
 		ZSWPOUT,
+		ZSWPOUT_FAIL,
 #endif
 #ifdef CONFIG_X86
 		DIRECT_MAP_LEVEL2_SPLIT,
--- a/mm/memcontrol.c~zswap-export-more-zswap-store-failure-stats
+++ a/mm/memcontrol.c
@@ -593,6 +593,7 @@ static const unsigned int memcg_vm_event
 #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP)
 	ZSWPIN,
 	ZSWPOUT,
+	ZSWPOUT_FAIL,
 #endif
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	THP_FAULT_ALLOC,
--- a/mm/vmstat.c~zswap-export-more-zswap-store-failure-stats
+++ a/mm/vmstat.c
@@ -1401,6 +1401,7 @@ const char * const vmstat_text[] = {
 #ifdef CONFIG_ZSWAP
 	"zswpin",
 	"zswpout",
+	"zswpout_fail",
 #endif
 #ifdef CONFIG_X86
 	"direct_map_level2_splits",
--- a/mm/zswap.c~zswap-export-more-zswap-store-failure-stats
+++ a/mm/zswap.c
@@ -62,6 +62,8 @@ static u64 zswap_pool_limit_hit;
 static u64 zswap_written_back_pages;
 /* Store failed due to a reclaim failure after pool limit was reached */
 static u64 zswap_reject_reclaim_fail;
+/* Store failed due to compression algorithm failure */
+static u64 zswap_reject_compress_fail;
 /* Compressed page was too big for the allocator to (optimally) store */
 static u64 zswap_reject_compress_poor;
 /* Store failed because underlying allocator could not get memory */
@@ -1221,10 +1223,10 @@ bool zswap_store(struct folio *folio)
 
 	/* Large folios aren't supported */
 	if (folio_test_large(folio))
-		return false;
+		goto out_reject;
 
 	if (!zswap_enabled || !tree)
-		return false;
+		goto out_reject;
 
 	/*
 	 * If this is a duplicate, it must be removed before attempting to store
@@ -1317,8 +1319,10 @@ bool zswap_store(struct folio *folio)
 	ret = crypto_wait_req(crypto_acomp_compress(acomp_ctx->req), &acomp_ctx->wait);
 	dlen = acomp_ctx->req->dlen;
 
-	if (ret)
+	if (ret) {
+		zswap_reject_compress_fail++;
 		goto put_dstmem;
+	}
 
 	/* store */
 	zpool = zswap_find_zpool(entry);
@@ -1385,8 +1389,12 @@ put_dstmem:
 freepage:
 	zswap_entry_cache_free(entry);
 reject:
-	if (objcg)
+	if (objcg) {
+		count_objcg_event(objcg, ZSWPOUT_FAIL);
 		obj_cgroup_put(objcg);
+	}
+out_reject:
+	count_vm_event(ZSWPOUT_FAIL);
 	return false;
 
 shrink:
@@ -1558,6 +1566,8 @@ static int zswap_debugfs_init(void)
 			   zswap_debugfs_root, &zswap_reject_alloc_fail);
 	debugfs_create_u64("reject_kmemcache_fail", 0444,
 			   zswap_debugfs_root, &zswap_reject_kmemcache_fail);
+	debugfs_create_u64("reject_compress_fail", 0444,
+			   zswap_debugfs_root, &zswap_reject_compress_fail);
 	debugfs_create_u64("reject_compress_poor", 0444,
 			   zswap_debugfs_root, &zswap_reject_compress_poor);
 	debugfs_create_u64("written_back_pages", 0444,
_

Patches currently in -mm which might be from nphamcs@gmail.com are

zswap-export-compression-failure-stats.patch


                 reply	other threads:[~2023-10-25 20:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231025201831.7AD35C433C7@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=ddstreet@ieee.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=sjenning@redhat.com \
    --cc=vitaly.wool@konsulko.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.