* [PATCH] zswap: export compression failure stats
@ 2023-10-24 23:45 Nhat Pham
2023-10-26 7:06 ` Sergey Senozhatsky
0 siblings, 1 reply; 2+ messages in thread
From: Nhat Pham @ 2023-10-24 23:45 UTC (permalink / raw)
To: akpm
Cc: hannes, cerasuolodomenico, yosryahmed, sjenning, ddstreet,
vitaly.wool, mhocko, roman.gushchin, shakeelb, muchun.song,
linux-mm, kernel-team, linux-kernel, cgroups
During a zswap store attempt, the compression algorithm could fail (for
e.g due to the page containing incompressible random data). This is not
tracked in any of existing zswap counters, making it hard to monitor for
and investigate. We have run into this problem several times in our
internal investigations on zswap store failures.
This patch adds a dedicated debugfs counter for compression algorithm
failures.
Signed-off-by: Nhat Pham <nphamcs@gmail.com>
---
mm/zswap.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 37d2b1cb2ecb..e12e76289226 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -61,6 +61,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 */
@@ -1309,8 +1311,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);
@@ -1550,6 +1554,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,
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] zswap: export compression failure stats
2023-10-24 23:45 [PATCH] zswap: export compression failure stats Nhat Pham
@ 2023-10-26 7:06 ` Sergey Senozhatsky
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2023-10-26 7:06 UTC (permalink / raw)
To: Nhat Pham
Cc: akpm, hannes, cerasuolodomenico, yosryahmed, sjenning, ddstreet,
vitaly.wool, mhocko, roman.gushchin, shakeelb, muchun.song,
linux-mm, kernel-team, linux-kernel, cgroups
On (23/10/24 16:45), Nhat Pham wrote:
>
> During a zswap store attempt, the compression algorithm could fail (for
> e.g due to the page containing incompressible random data). This is not
> tracked in any of existing zswap counters, making it hard to monitor for
> and investigate. We have run into this problem several times in our
> internal investigations on zswap store failures.
>
> This patch adds a dedicated debugfs counter for compression algorithm
> failures.
>
> Signed-off-by: Nhat Pham <nphamcs@gmail.com>
FWIW,
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-26 7:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 23:45 [PATCH] zswap: export compression failure stats Nhat Pham
2023-10-26 7:06 ` Sergey Senozhatsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox