From: Harry Yoo <harry@kernel.org>
To: SJ Park <sj@kernel.org>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Yosry Ahmed" <yosry@kernel.org>, "Nhat Pham" <nphamcs@gmail.com>,
"Usama Arif" <usamaarif642@gmail.com>,
"Chengming Zhou" <chengming.zhou@linux.dev>,
"Tejun Heo" <tj@kernel.org>, "Michal Koutný" <mkoutny@suse.com>,
"Shuah Khan" <shuah@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Joshua Hahn" <joshua.hahnjy@gmail.com>,
"Kiryl Shutsemau" <kas@kernel.org>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/cgroup: ignore memory.reclaim -EAGAIN for zswap writeback test
Date: Tue, 15 Sep 2026 11:21:53 +0100 [thread overview]
Message-ID: <aqkavo7OfQdMOpLf@thinkstation> (raw)
In-Reply-To: <20260915001817.101713-1-sj@kernel.org>
On Mon, Sep 14, 2026 at 05:18:17PM -0700, SJ Park wrote:
> Hi Harry,
Hi SJ, thanks for looking into it!
> On Mon, 14 Sep 2026 21:36:39 +0100 "Harry Yoo (Meta)" <harry@kernel.org> wrote:
> Makes sense to me.
Thanks!
> [...]
> > --- a/tools/testing/selftests/cgroup/test_zswap.c
> > +++ b/tools/testing/selftests/cgroup/test_zswap.c
> > @@ -346,7 +346,16 @@ static int attempt_writeback(const char *cgroup, void *arg)
> > * it can't writeback to swap.
> > */
> > ret = cg_write_numeric(cgroup, "memory.reclaim", memsize);
> > - if (!wb_enabled)
> > +
> > + /*
> > + * When writeback is enabled, memory.reclaim may still fail to reclaim
> > + * the requested amount of memory due to a slow swap device.
> > + * Ignore -EAGAIN here. The caller determines pass/fail based on the
> > + * zswap writeback counter.
> > + */
> > + if (wb_enabled && ret == -EAGAIN)
> > + ret = 0;
> > + else if (!wb_enabled)
> > ret = (ret == -EAGAIN) ? 0 : -1;
>
> My humble eyes were unable to easily understand the change. Is the change
> effectively same to below, and if so, would this be easier to read?
>
> '''
> @@ -344,10 +344,11 @@ static int attempt_writeback(const char *cgroup, void *arg)
> * writeback as zswap.max is 1/4 of what was needed when reclaim ran the first time.
> * If writeback is disabled, memory reclaim will fail as zswap is limited and
> * it can't writeback to swap.
> + * Even if writeback is enabled, it could return -EAGAIN due to a slow
> + * swap device.
> */
> ret = cg_write_numeric(cgroup, "memory.reclaim", memsize);
> - if (!wb_enabled)
> - ret = (ret == -EAGAIN) ? 0 : -1;
> + ret = (ret == -EAGAIN) ? 0 : -1;
Hmm, no. This will mark the test as failed when a write to
memory.reclaim returns zero even when wb_enabled is true.
It's not the same because when wb_enabled == true we consider
ret == 0 or ret == -EAGAIN as success, while with wb_enabled == false
we consider ret == -EAGAIN as success.
Not sure we can reduce that to one line of code.
> out:
> free(mem);
> '''
--
Cheers,
Harry / Hyeonggon
prev parent reply other threads:[~2026-09-15 10:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 20:36 Harry Yoo (Meta)
2026-09-15 0:18 ` SJ Park
2026-09-15 10:21 ` Harry Yoo [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=aqkavo7OfQdMOpLf@thinkstation \
--to=harry@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=joshua.hahnjy@gmail.com \
--cc=kas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mkoutny@suse.com \
--cc=nphamcs@gmail.com \
--cc=shuah@kernel.org \
--cc=sj@kernel.org \
--cc=tj@kernel.org \
--cc=usamaarif642@gmail.com \
--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
all inboxes | Powered by JetHome®