Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tomás Senart" <ts@perfloop.ai>,
	akpm@linux-foundation.org, yosry@kernel.org, hannes@cmpxchg.org,
	nphamcs@gmail.com
Cc: roman.gushchin@linux.dev, tj@kernel.org,
	chengming.zhou@linux.dev, mkoutny@suse.com, linux-mm@kvack.org,
	mhocko@kernel.org, shakeel.butt@linux.dev, muchun.song@linux.dev,
	cerasuolodomenico@gmail.com, shuah@kernel.org
Subject: Re: [PATCH] mm: zswap: honor zero cgroup limits after successful reclaim
Date: Thu, 12 Nov 2026 23:23:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-211950@kernel.org> (raw)
In-Reply-To: <20261112-zswap-zero-limit-v1-1-19f33081b09e@perfloop.ai>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/cgroup: missing wait for populated 0 in
  test_zswap_max_zero()
- [Low] selftests/cgroup: silent KSFT_SKIP returns in
  test_zswap_max_zero()
--

commit cb5209a5f058b3ca9ae23b219994b4a826f192b3
Author: Tomás Senart <ts@perfloop.ai>

mm: zswap: honor zero cgroup limits after successful reclaim

This commit checks for a zero zswap limit across the cgroup hierarchy after
reclaiming entries in zswap_store() so that a cgroup with memory.zswap.max
set to zero does not store newly compressed pages, and adds a selftest.

> diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c
> index d50acc1b83ac8..7632aadd88662 100644
> --- a/tools/testing/selftests/cgroup/test_zswap.c
> +++ b/tools/testing/selftests/cgroup/test_zswap.c

[ ... ]

> @@ -244,6 +245,105 @@ static int test_swapin_nozswap(const char *root)
> +static int test_zswap_max_zero(const char *root)
> +{
> +	char *group = NULL, *child = NULL;
> +	int ret = KSFT_FAIL;
> +
> +	if (access(PATH_ZSWAP_STORED_PAGES, R_OK) ||
> +	    access(PATH_ZSWAP_WRITTEN_BACK_PAGES, R_OK))
> +		return KSFT_SKIP;
> +	if (cg_read_strcmp(root, "memory.zswap.writeback", "1"))
> +		return KSFT_SKIP;

[Severity: Low]
This isn't a bug, but returning KSFT_SKIP here without calling
ksft_print_msg() leaves out why the test was skipped, since main() only
passes the test name to ksft_test_result_skip().

> +
> +	group = cg_name(root, "zswap_max_zero_test");
> +	if (!group || cg_create(group))
> +		goto out;
> +	if (cg_run(group, pageout_zero_limit, group))
> +		goto out;
> +
> +	if (cg_write(group, "memory.zswap.max", "max"))
> +		goto out;
> +	if (cg_write(group, "cgroup.subtree_control", "+memory"))
> +		goto out;

[Severity: Low]
Can writing "+memory" to cgroup.subtree_control fail intermittently with
-EBUSY right after cg_run() returns?

In the exit path, exit_notify() wakes waitpid() in cg_run() before the
dying child completes its final context switch in finish_task_switch() ->
cgroup_task_dead(), which decrements nr_populated_csets.  If the parent
writes "+memory" to group/cgroup.subtree_control before that happens (such
as on a single-CPU VM), cgroup_vet_subtree_control_enable() sees
cgroup_has_tasks(cgrp) and rejects the write with -EBUSY, causing a false
test failure.

Wait for the cgroup to become unpopulated with
cg_read_strcmp_wait(group, "cgroup.events", "populated 0\n") before
enabling "+memory", as done in test_zswap_writeback() since commit
5547ee3a76b2 ("selftests/cgroup: test_zswap: wait for cgroup to unpopulate
in test_zswap_writeback").

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-zswap-zero-limit-v1-1-19f33081b09e@perfloop.ai?part=1


      parent reply	other threads:[~2026-11-12 23:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 23:23 [PATCH] mm: zswap: honor zero cgroup limits after successful reclaim Tomás Senart via B4 Relay
2026-11-11 23:28 ` Yosry Ahmed
2026-11-12  0:55   ` Tomás Senart
2026-11-12 15:45     ` Nhat Pham
2026-11-12 16:37       ` Yosry Ahmed
2026-11-12 23:23 ` sashiko-bot [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=sashiko-outbox-211950@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=roman.gushchin@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.org \
    --cc=ts@perfloop.ai \
    --cc=yosry@kernel.org \
    /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