linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nhat Pham <nphamcs@gmail.com>
To: Takero Funaki <flintglass@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Yosry Ahmed <yosryahmed@google.com>,
	 Chengming Zhou <chengming.zhou@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] mm: zswap: fix global shrinker error handling logic
Date: Fri, 2 Aug 2024 15:51:52 -0700	[thread overview]
Message-ID: <CAKEwX=NB0MGFy2WxMebd_cZEQ__pcTH5_-LX_M85ti6NyGhmKw@mail.gmail.com> (raw)
In-Reply-To: <20240731004918.33182-3-flintglass@gmail.com>

On Tue, Jul 30, 2024 at 5:49 PM Takero Funaki <flintglass@gmail.com> wrote:
>
> This patch fixes the zswap global shrinker, which did not shrink the
> zpool as expected.
>
> The issue addressed is that shrink_worker() did not distinguish between
> unexpected errors and expected errors, such as failed writeback from an
> empty memcg. The shrinker would stop shrinking after iterating through
> the memcg tree 16 times, even if there was only one empty memcg.
>
> With this patch, the shrinker no longer considers encountering an empty
> memcg, encountering a memcg with writeback disabled, or reaching the end
> of a memcg tree walk as a failure, as long as there are memcgs that are
> candidates for writeback. Systems with one or more empty memcgs will now
> observe significantly higher zswap writeback activity after the zswap
> pool limit is hit.
>
> To avoid an infinite loop when there are no writeback candidates, this
> patch tracks writeback attempts during memcg tree walks and limits
> reties if no writeback candidates are found.
>
> To handle the empty memcg case, the helper function shrink_memcg() is
> modified to check if the memcg is empty and then return -ENOENT.
>
> Fixes: a65b0e7607cc ("zswap: make shrinking memcg-aware")
> Signed-off-by: Takero Funaki <flintglass@gmail.com>

Nice! LGTM FWIW.
Reviewed-by: Nhat Pham <nphamcs@gmail.com>

Thank you so much for working on this, Takero! I look forward to your
other global shrinker fixes :)


      parent reply	other threads:[~2024-08-02 22:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  0:49 [PATCH v5 0/2] mm: zswap: fixes for global shrinker Takero Funaki
2024-07-31  0:49 ` [PATCH v5 1/2] mm: zswap: fix global shrinker memcg iteration Takero Funaki
2024-08-03  4:14   ` Yosry Ahmed
2024-07-31  0:49 ` [PATCH v5 2/2] mm: zswap: fix global shrinker error handling logic Takero Funaki
2024-08-01  7:40   ` Chengming Zhou
2024-08-02 22:51   ` Nhat Pham [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKEwX=NB0MGFy2WxMebd_cZEQ__pcTH5_-LX_M85ti6NyGhmKw@mail.gmail.com' \
    --to=nphamcs@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=flintglass@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox