Re: [PATCH 2/2] mm/zswap: classify compression dst overflow as poor compression
From: Suseendran Bhaskaran
Date: Thu Oct 22 2026 - 18:05:33 EST
On Thu, Oct 22, 2026 at 12:15:51PM -0700, Yosry Ahmed wrote:
> On Thu, Oct 22, 2026 at 11:33 AM Suseendran Bhaskaran
> <suseendranb@xxxxxxxxxx> wrote:
[...]
> > Since dlen is only valid when !comp_ret, we could normalize comp_ret
> > first when !comp_ret and then just check 'if (comp_ret)':
> >
> > diff --git a/mm/zswap.c b/mm/zswap.c
> > --- a/mm/zswap.c
> > +++ b/mm/zswap.c
> > @@ -874,19 +874,24 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry,
> > */
> > comp_ret = crypto_wait_req(crypto_acomp_compress(acomp_ctx->req), &acomp_ctx->wait);
> > dlen = acomp_ctx->req->dlen;
> > + if (!comp_ret) {
> > + if (dlen == PAGE_SIZE)
> > + comp_ret = -ENOSPC;
> > + else if (WARN_ON_ONCE(!dlen || dlen > PAGE_SIZE))
> > + comp_ret = -EINVAL;
> > + }
> >
> > /*
> > * If a page cannot be compressed into a size smaller than PAGE_SIZE,
> > * save the content as is without a compression, to keep the LRU order
> > * of writebacks. If writeback is disabled, reject the page since it
> > * only adds metadata overhead. swap_writeout() will put the page back
> > * to the active LRU list in the case.
> > */
> > - if (comp_ret || !dlen || dlen >= PAGE_SIZE) {
> > + if (comp_ret) {
> > rcu_read_lock();
> > if (!mem_cgroup_zswap_writeback_enabled(
> > folio_memcg(page_folio(page)))) {
> > rcu_read_unlock();
> > - comp_ret = comp_ret ? comp_ret : -EINVAL;
> > goto unlock;
> > }
> >
> > Does this look good to you?
>
> Yes. I assume this is completely independent from patch 1, so we can
> tell Herbert to pick up patch 1 and send this separately?
Yes, this change is completely independent from patch 1. Herbert can
pick up patch 1 as-is.
I will address the latest Sashiko finding on patch 2 and send the updated
patch as a standalone change separately.