Re: [PATCH v2 2/2] mm/zswap: Support batch writeback in shrink_memcg()

From: Nhat Pham

Date: Fri Jul 24 2026 - 14:42:48 EST


On Fri, Jul 24, 2026 at 10:57 AM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> The numbers generally look good, the store rejection rate is
> decreasing and we are naturally doing more writeback which makes
> sense. The store rejection rate actually increases when the batch size
> increases to 64, maybe aggressive writeback is more likely to fail and
> cause a store rejection, so that also makes sense.
>
> The only part I can't immediately reason about is pswpin. How are we
> reading from physical swap more than we ever wrote to it?

The same page can be swapped out once, and swap in multiple times :)

Unlike zswap, physical swap in is not necessarily exclusive. You load
the page in memory, but if the swapfile is not full, etc. etc. you
don't invalidate the copy of the data on the swapfile. At reclaim
time, we notice the page is not dirty, so we just skip (z)swapout.