From: Barry Song <v-songbaohua@xxxxxxxx> My commit fc8580edbaa6 ("mm: zsmalloc: return -ENOSPC rather than -EINVAL in zs_malloc while size is too large") wanted to depend on zs_malloc's returned ENOSPC to distinguish the case that compressed data is larger than the original data from normal compression cases. The commit, for sure, was correct and worked as expected but the code wouldn't run to there after commit 744e1885922a ("crypto: scomp - fix req->dst buffer overflow") as Chengming's this patch makes zswap_store() goto out immediately after the special compression case happens. So there is no chance to execute zs_malloc() now. We need to fix the count right after compressions return ENOSPC. Fixes: fc8580edbaa6 ("mm: zsmalloc: return -ENOSPC rather than -EINVAL in zs_malloc while size is too large") Cc: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> Cc: Nhat Pham <nphamcs@xxxxxxxxx> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx> --- mm/zswap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/zswap.c b/mm/zswap.c index 6319d2281020..9a21dbe8c056 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1627,7 +1627,10 @@ bool zswap_store(struct folio *folio) dlen = acomp_ctx->req->dlen; if (ret) { - zswap_reject_compress_fail++; + if (ret == -ENOSPC) + zswap_reject_compress_poor++; + else + zswap_reject_compress_fail++; goto put_dstmem; } -- 2.34.1