From: SeongJae Park <sj@kernel.org>
To: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Cc: SeongJae Park <sj@kernel.org>,
shuah@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] selftests/damon: add regression test for damos_walk() vs kdamond exit race
Date: Thu, 11 Jun 2026 17:11:21 -0700 [thread overview]
Message-ID: <20260612001122.27512-1-sj@kernel.org> (raw)
In-Reply-To: <CAF+TLO2PX71_-9nKBEAJ50+NpjNkgipig6=9OLsvbgZtqF2yew@mail.gmail.com>
On Fri, 12 Jun 2026 02:06:51 +0530 Sailesh Nandanavanam <saileshnandanavanam@gmail.com> wrote:
> Hello SeongJae,
>
> Noted on inline replies - I'll follow that format from the next response.
>
> Following up on this thread with progress.
>
> As discussed, I dropped the userspace selftest approach since it
> cannot reliably trigger the microsecond-wide race window.
>
> I wrote a KUnit test instead, added to mm/damon/tests/core-kunit.h:
>
> - Creates a damon_ctx
> - Sets ctx->walk_control_obsolete = true under walk_control_lock,
> simulating the state just before kdamond_fn() exits
I don't think you don't need to hold the lock, since this is just a unit test
and there should be no race for the test.
> - Calls damos_walk() and verifies it returns -ECANCELED immediately
>
> I built and ran this on a kernel with commit 33c3f6c2b48c
> ("mm/damon/core: fix damos_walk() vs kdamond_fn() exit race") present,
> and the test passes along with all other 28 existing damon KUnit
> tests:
>
> ok 29 damon_test_walk_control_obsolete
> # damon: pass:29 fail:0 skip:0 total:29
>
> Since walk_control_obsolete is a field introduced by this fix, a
> kernel with the fix reverted would not compile this test (the field
> would not exist). So the usual "fails before fix, passes after fix"
> verification does not apply the same way here - the test directly
> validates the new field/behavior introduced by the fix.
>
> If this approach looks reasonable, I plan to send v3 with this KUnit
> test (replacing the userspace selftest from v1/v2), along with the
> commit message format and other minor fixes from your earlier review.
Other than the trivial comment about locking, your plan soudns reasonable to
me. Looking forward to your next patch!
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-06-12 0:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-24 10:02 [PATCH v2] selftests/damon: add regression test for damos_walk() vs kdamond exit race Sailesh Nandanavanam
2026-05-24 18:37 ` SeongJae Park
2026-06-05 7:14 ` Sailesh Nandanavanam
2026-06-05 9:55 ` Sailesh Nandanavanam
2026-06-06 0:36 ` SeongJae Park
2026-06-11 20:20 ` Sailesh Nandanavanam
2026-06-11 20:36 ` Sailesh Nandanavanam
2026-06-12 0:11 ` SeongJae Park [this message]
2026-06-12 6:23 ` [PATCH v3] mm/damon: add KUnit test for walk_control_obsolete behavior Sailesh Nandanavanam
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=20260612001122.27512-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=saileshnandanavanam@gmail.com \
--cc=shuah@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