Re: [PATCH 0/2] minimize swapping on zswap store failure
From: Sergey Senozhatsky
Date: Thu Apr 03 2025 - 21:46:38 EST
On (25/04/03 13:38), Nhat Pham wrote:
> > Ultimately the goal is to prevent an incompressible page from hoarding the
> > compression algorithm on multiple reclaim attempts, but if we are spending
> > more time by allocating new pages... maybe this isn't the correct approach :(
>
> Hmmm, IIUC this problem also exists with zram, since zram allocates a
> PAGE_SIZE sized buffer to hold the original page's content. I will
> note though that zram seems to favor these kinds of pages for
> writeback :) Maybe this is why...?
zram is a generic block device, it must store whatever comes in,
compressible or incompressible. E.g. when we have, say, ext4
running atop of the zram device we cannot reject page stores.
And you are right, when we use zram for swap, there is some benefit
in storing incompressible pages. First, those pages are candidates
for zram writeback, which achieves the goal of removing the page from
RAM after all, we give up on the incompressible page reclamation with
"return it back to LRU" approach. Second, on some zram setups we do
re-compression (with a slower and more efficient algorithm) and in
certain number of cases what is incompressible with the primary (fast)
algorithm is compressible with the secondary algorithm.