[PATCH v4 0/2] mm/zswap: Fixes and improves the zswap shrink

Hao Jia posted 2 patches 1 month, 3 weeks ago
mm/zswap.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
[PATCH v4 0/2] mm/zswap: Fixes and improves the zswap shrink
Posted by Hao Jia 1 month, 3 weeks ago
From: Hao Jia <jiahao1@lixiang.com>

This series fixes and improves the zswap global shrinker (shrink_worker()):
Patch 1: Fix missing global shrinker when memory cgroup is disabled.
Patch 2: Extend shrink_memcg() to support batch writeback and thereby improving
         the writeback efficiency in the shrink_worker() and zswap_store() paths.

v3->v4:
    - Remove the nr_to_scan parameter from shrink_memcg() and cap the per-node
      scan count at SWAP_CLUSTER_MAX to avoid writeback unfairness across NUMA
      nodes caused by a shared global scan quota.
v2->v3:
    - Added user impact to the commit 1 message.
    - Updated writeback batch size to SWAP_CLUSTER_MAX to avoid introducing new
      magic macros. And enabled batched shrinking in the zswap_store() path as well.
    - Re-benchmarked performance data with the updated patch.
v1->v2:
    - Add a reschedule check to the -ENOENT return path in shrink_memcg() to
      handle the theoretical issue of prolonged heavy concurrent zswap stores.
    - Remove the shrink_memcg() return value changes part, and include a more
       detailed test report in the commit message.

[v3] https://lore.kernel.org/all/20260729084206.77793-1-jiahao.kernel@gmail.com
[v2] https://lore.kernel.org/all/20260717085151.22822-1-jiahao.kernel@gmail.com
[v1] https://lore.kernel.org/all/20260714081510.16895-1-jiahao.kernel@gmail.com

Hao Jia (2):
  mm/zswap: Fix global shrinker when memory cgroup is disabled
  mm/zswap: Support batch writeback in shrink_memcg()

 mm/zswap.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

-- 
2.34.1
Re: [PATCH v4 0/2] mm/zswap: Fixes and improves the zswap shrink
Posted by Andrew Morton 1 month, 3 weeks ago
On Thu,  6 Aug 2026 15:09:41 +0800 Hao Jia <jiahao.kernel@gmail.com> wrote:

> From: Hao Jia <jiahao1@lixiang.com>
> 
> This series fixes and improves the zswap global shrinker (shrink_worker()):
> Patch 1: Fix missing global shrinker when memory cgroup is disabled.
> Patch 2: Extend shrink_memcg() to support batch writeback and thereby improving
>          the writeback efficiency in the shrink_worker() and zswap_store() paths.

Thanks.

Why is a -stable backport proposed for [1/2]?  Its changelog should
describe the effect of the bug upon our users so that others can
understand why this was requested.

AI review suggests there may be an issue in [1/2].  Please check?
	https://sashiko.dev/#/patchset/20260806070943.95542-1-jiahao.kernel@gmail.com
Re: [PATCH v4 0/2] mm/zswap: Fixes and improves the zswap shrink
Posted by Yosry Ahmed 1 month, 3 weeks ago
On Thu, Aug 6, 2026 at 3:41 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu,  6 Aug 2026 15:09:41 +0800 Hao Jia <jiahao.kernel@gmail.com> wrote:
>
> > From: Hao Jia <jiahao1@lixiang.com>
> >
> > This series fixes and improves the zswap global shrinker (shrink_worker()):
> > Patch 1: Fix missing global shrinker when memory cgroup is disabled.
> > Patch 2: Extend shrink_memcg() to support batch writeback and thereby improving
> >          the writeback efficiency in the shrink_worker() and zswap_store() paths.
>
> Thanks.
>
> Why is a -stable backport proposed for [1/2]?  Its changelog should
> describe the effect of the bug upon our users so that others can
> understand why this was requested.

It's a potential performance regression for people using zswap without
memcg that was introduced by the commit in "Fixes".

>
> AI review suggests there may be an issue in [1/2].  Please check?
>         https://sashiko.dev/#/patchset/20260806070943.95542-1-jiahao.kernel@gmail.com

Same thing from previous versions, shouldn't be a problem in practice.