summaryrefslogtreecommitdiff
path: root/mm/zswap.c
diff options
context:
space:
mode:
authorChengming Zhou <zhouchengming@bytedance.com>2024-02-04 03:06:01 +0000
committerAndrew Morton <akpm@linux-foundation.org>2024-02-22 10:24:54 -0800
commitb49547ade38a63ff39c9fbc53fb38622cb63854a (patch)
treedda6b34e05378084c6d75a45245d48b21ad8fc50 /mm/zswap.c
parent0827a1fb143fae588cb6f5b9a97c405d6c2ddec9 (diff)
mm/zswap: stop lru list shrinking when encounter warm region
When the shrinker encounter an existing folio in swap cache, it means we are shrinking into the warmer region. We should terminate shrinking if we're in the dynamic shrinker context. This patch add LRU_STOP to support this, to avoid overshrinking. Link: https://lkml.kernel.org/r/20240201-b4-zswap-invalidate-entry-v2-3-99d4084260a0@bytedance.com Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Nhat Pham <nphamcs@gmail.com> Reviewed-by: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/zswap.c')
-rw-r--r--mm/zswap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/zswap.c b/mm/zswap.c
index ef41a7bd81f2..f8a4ac389118 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1315,8 +1315,10 @@ static enum lru_status shrink_memcg_cb(struct list_head *item, struct list_lru_o
* into the warmer region. We should terminate shrinking (if we're in the dynamic
* shrinker context).
*/
- if (writeback_result == -EEXIST && encountered_page_in_swapcache)
+ if (writeback_result == -EEXIST && encountered_page_in_swapcache) {
+ ret = LRU_STOP;
*encountered_page_in_swapcache = true;
+ }
} else {
zswap_written_back_pages++;
}