]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm: zswap: increase reject_compress_poor but not reject_compress_fail if compression...
authorBarry Song <v-songbaohua@oppo.com>
Mon, 19 Feb 2024 21:19:35 +0000 (10:19 +1300)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 24 Feb 2024 01:48:31 +0000 (17:48 -0800)
commit55e78c933d747ed44b2b22879e6a55e5af34b9f7
tree785436d62939bded2689efaf961e38aa65c16180
parent929e4c3534ecdc6c11921dff5a54597c5d61ca6a
mm: zswap: increase reject_compress_poor but not reject_compress_fail if compression returns ENOSPC

We used to rely on the returned -ENOSPC of zpool_malloc() to increase
reject_compress_poor.  But the code wouldn't get to there after commit
744e1885922a ("crypto: scomp - fix req->dst buffer overflow") as the new
code will goto out immediately after the special compression case happens.
So there might be no longer a chance to execute zpool_malloc now.  We are
incorrectly increasing zswap_reject_compress_fail instead.  Thus, we need
to fix the counters handling right after compressions return ENOSPC.  This
patch also centralizes the counters handling for all of compress_poor,
compress_fail and alloc_fail.

Link: https://lkml.kernel.org/r/20240219211935.72394-1-21cnbao@gmail.com
Fixes: 744e1885922a ("crypto: scomp - fix req->dst buffer overflow")
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zswap.c