On Fri, Jul 5, 2024 at 7:25 PM Takero Funaki <flintglass@xxxxxxxxx> wrote: > > This patch allows zswap to accept incompressible pages and store them > into zpool if possible. > > This change is required to achieve zero rejection on zswap_store(). With > proper amount of proactive shrinking, swapout can be buffered by zswap > without IO latency. Storing incompressible pages may seem costly, but it > can reduce latency. A rare incompressible page in a large batch of > compressive pages can delay the entire batch during swapping. > > The memory overhead is negligible because the underlying zsmalloc > already accepts nearly incompressible pages. zsmalloc stores data close > to PAGE_SIZE to a dedicated page. Thus storing as-is saves decompression > cycles without allocation overhead. zswap itself has not rejected pages > in these cases. > > To store the page as-is, use the compressed data size field `length` in > struct `zswap_entry`. The length == PAGE_SIZE indicates > incompressible data. > > If a zpool backend does not support allocating PAGE_SIZE (zbud), the > behavior remains unchanged. The allocation failure reported by the zpool > blocks accepting the page as before. > > Signed-off-by: Takero Funaki <flintglass@xxxxxxxxx> I tried to propose something similar in the past. Please read the following discussion: https://lore.kernel.org/all/CAJD7tka6XRyzYndRNEFZmi0Zj4DD2KnVzt=vMGhfF4iN2B4VKw@xxxxxxxxxxxxxx/ But, the TLDR is Yosry was (rightly) concerned that with this approach, memory reclaiming could end up increasing memory usage rather than reducing (since we do not free up the page that fail to zswap-out, and we need extra memory for the zswap metadata of that page). So my vote on this patch would be NACK, until we get around this issue somehow :)