Re: [PATCH 1/2] zswap: implement a second chance algorithm for dynamic zswap shrinker
From: Nhat Pham
Date: Tue Jul 30 2024 - 18:04:56 EST
On Tue, Jul 30, 2024 at 11:46 AM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
>
> I also think it's important to clarify that there are two mechanisms
> that control the writeback rate with this patch, the reference bit
> proportional slowdown (protecting against writeback of recently
> swapped out pages), and nr_swapins protection (feedback from swapins
> of recently written back pages).
Regarding this - perhaps I wasn't being clear, but I did include both
in the changelog. The latter is this paragraph:
"We will still maintain the count of swapins, which is consumed and
subtracted from the lru size in zswap_shrinker_count(), to further
penalize past overshrinking that led to disk swapins. The idea is that
had we considered this many more pages in the LRU active/protected, they
would not have been written back and we would not have had to swapped
them in."
I also replicate this comment in the nr_swapin explanation - see
struct zswap_lruvec_state.
Same goes with the second chance algorithm - I did briefly explain it
in shrink_memcg_cb(), as well as the changelog.
>
> Maybe we can move things around to make it more obvious how these
> mechanisms work hand in hand, or have a comment somewhere describing
> the writeback mechanism.
Hmm let me add some documentation for this near
zswap_shrinker_{scan|count}() definitions: