From: Takero Funaki <flintglass@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Yosry Ahmed <yosryahmed@google.com>,
Nhat Pham <nphamcs@gmail.com>,
Chengming Zhou <chengming.zhou@linux.dev>,
Jonathan Corbet <corbet@lwn.net>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/6] mm: zswap: global shrinker fix and proactive shrink
Date: Sun, 7 Jul 2024 19:54:04 +0900 [thread overview]
Message-ID: <CAPpoddfn26cKCWC4KERT7Rd=HzJwSEjGPQtpgEaEYONeHSKOzg@mail.gmail.com> (raw)
In-Reply-To: <20240706103254.ffd02d7036fa3fe43dbed806@linux-foundation.org>
2024年7月7日(日) 2:32 Andrew Morton <akpm@linux-foundation.org>:
> Seems that patches 1 & 2 might be worthy of backporting into earlier
> kernels? Could you please provide a description of the
> userspace-visible effects of the bugs so the desirability of such an
> action can be better understood?
Patch 1 and Patch 2 partially resolve the zswap global shrinker that
leads to performance degradation on small systems. However, the fix
uncovers another issue addressed in patches 3 to 6. Backporting only
the two patches can be a tradeoff with possible performance
degradation in some cases. I am not sure the possible issue can be
acceptable.
The visible issue is described in the cover letter:
> Visible issue to resolve
> -------------------------------
> The visible issue with the current global shrinker is that pageout/in
> operations from active processes are slow when zswap is near its max
> pool size. This is particularly significant on small memory systems
> where total swap usage exceeds what zswap can store. This results in old
> pages occupying most of the zswap pool space, with recent pages using
> the swap disk directly.
>
> Root cause of the issue
> -------------------------------
> This issue is caused by zswap maintaining the pool size near 100%. Since
> the shrinker fails to shrink the pool to accept_threshold_percent, zswap
> rejects incoming pages more frequently than it should. The rejected
> pages are directly written to disk while zswap protects old pages from
> eviction, leading to slow pageout/in performance for recent pages.
Patches 1 and 2 partially resolve the issue by fixing iteration logic.
With the two patches applied, zswap shrinker starts evicting pages
once the pool limit is hit, as described in the current zswap
documentation. However, this fix might not give performance
improvement since it lacks proactive shrinking required to prepare
spaces before pool limit is hit, implemented in patch 3.
Unfortunately, the fix uncovers another issue described in the bottom
half of the cover letter. Because the shrinker performs writeback
simultaneously with pageout for rejected pages, the shrinker delays
actual memory reclaim unnecessarily. The first issue masked the second
by virtually disabling the global shrinker writeback. I think the
second issue only occurs under severe memory pressure, but may degrade
pageout performance as shown in the benchmark at the bottom of the
cover letter.
next prev parent reply other threads:[~2024-07-07 10:54 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-06 2:25 [PATCH v2 0/6] mm: zswap: global shrinker fix and proactive shrink Takero Funaki
2024-07-06 2:25 ` [PATCH v2 1/6] mm: zswap: fix global shrinker memcg iteration Takero Funaki
2024-07-08 4:54 ` Chengming Zhou
2024-07-17 1:54 ` Yosry Ahmed
2024-07-06 2:25 ` [PATCH v2 2/6] mm: zswap: fix global shrinker error handling logic Takero Funaki
2024-07-17 2:39 ` Yosry Ahmed
2024-07-06 2:25 ` [PATCH v2 3/6] mm: zswap: proactive shrinking before pool size limit is hit Takero Funaki
2024-07-12 23:18 ` Nhat Pham
2024-07-06 2:25 ` [PATCH v2 4/6] mm: zswap: make writeback run in the background Takero Funaki
2024-07-06 2:25 ` [PATCH v2 5/6] mm: zswap: store incompressible page as-is Takero Funaki
2024-07-06 23:53 ` Nhat Pham
2024-07-07 9:38 ` Takero Funaki
2024-07-12 22:36 ` Nhat Pham
2024-07-08 3:56 ` Chengming Zhou
2024-07-08 13:44 ` Takero Funaki
2024-07-09 13:26 ` Chengming Zhou
2024-07-12 22:47 ` Nhat Pham
2024-07-16 2:30 ` Chengming Zhou
2024-07-06 2:25 ` [PATCH v2 6/6] mm: zswap: interrupt shrinker writeback while pagein/out IO Takero Funaki
2024-07-08 19:17 ` Nhat Pham
2024-07-09 0:57 ` Nhat Pham
2024-07-10 21:21 ` Takero Funaki
2024-07-10 22:10 ` Nhat Pham
2024-07-15 7:33 ` Takero Funaki
2024-07-06 17:32 ` [PATCH v2 0/6] mm: zswap: global shrinker fix and proactive shrink Andrew Morton
2024-07-07 10:54 ` Takero Funaki [this message]
2024-07-09 0:53 ` Nhat Pham
2024-07-10 22:26 ` Takero Funaki
2024-07-12 23:02 ` Nhat Pham
2024-07-15 8:20 ` Takero Funaki
2024-07-26 18:13 ` Nhat Pham
2024-07-26 18:25 ` Nhat Pham
2024-07-17 2:53 ` Yosry Ahmed
2024-07-17 17:49 ` Nhat Pham
2024-07-17 18:05 ` Yosry Ahmed
2024-07-17 19:01 ` Nhat Pham
2024-07-19 14:55 ` Takero Funaki
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='CAPpoddfn26cKCWC4KERT7Rd=HzJwSEjGPQtpgEaEYONeHSKOzg@mail.gmail.com' \
--to=flintglass@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=chengming.zhou@linux.dev \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).