summaryrefslogtreecommitdiff
path: root/mm/zswap.c?id=81920438a6dce78e6eac17ee34f29bf6c32074b1
diff options
context:
space:
mode:
authorTakero Funaki <flintglass@gmail.com>2024-07-31 00:49:10 +0000
committerAndrew Morton <akpm@linux-foundation.org>2024-09-01 20:25:58 -0700
commit81920438a6dce78e6eac17ee34f29bf6c32074b1 (patch)
tree54a97039cf3c06ab3e648425d125af3e25fa512c /mm/zswap.c?id=81920438a6dce78e6eac17ee34f29bf6c32074b1
parentc5519e0a9bfb6365445de0521a6fe7000b375ecf (diff)
mm: zswap: fix global shrinker error handling logic
This patch fixes the zswap global shrinker, which did not shrink the zpool as expected. The issue addressed is that shrink_worker() did not distinguish between unexpected errors and expected errors, such as failed writeback from an empty memcg. The shrinker would stop shrinking after iterating through the memcg tree 16 times, even if there was only one empty memcg. With this patch, the shrinker no longer considers encountering an empty memcg, encountering a memcg with writeback disabled, or reaching the end of a memcg tree walk as a failure, as long as there are memcgs that are candidates for writeback. Systems with one or more empty memcgs will now observe significantly higher zswap writeback activity after the zswap pool limit is hit. To avoid an infinite loop when there are no writeback candidates, this patch tracks writeback attempts during memcg tree walks and limits reties if no writeback candidates are found. To handle the empty memcg case, the helper function shrink_memcg() is modified to check if the memcg is empty and then return -ENOENT. Link: https://lkml.kernel.org/r/20240731004918.33182-3-flintglass@gmail.com Fixes: a65b0e7607cc ("zswap: make shrinking memcg-aware") Signed-off-by: Takero Funaki <flintglass@gmail.com> Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/zswap.c?id=81920438a6dce78e6eac17ee34f29bf6c32074b1')
0 files changed, 0 insertions, 0 deletions