From: SeongJae Park <sj@kernel.org>
To: niecheng <niecheng1@uniontech.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,
kernel@uniontech.com
Subject: Re: [PATCH 2/2] selftests/damon: validate memcg filter sysfs readback
Date: Thu, 28 May 2026 07:28:18 -0700 [thread overview]
Message-ID: <20260528142819.153573-1-sj@kernel.org> (raw)
In-Reply-To: <406BD1BA0F6AE326+20260528081039.1192194-3-niecheng1@uniontech.com>
Hello niecheng,
Could we use 'selftests/damn/sysfs.py:' as the prefix of the subject? That
will make it consistent with other commits and let us easily know to what test
this change is made.
On Thu, 28 May 2026 16:10:39 +0800 niecheng <niecheng1@uniontech.com> wrote:
> Add memcg filter validation to the DAMON sysfs selftest by checking the
> memcg_path sysfs readback.
>
> Validate the readback path rather than a derived memcg_id so that the
> test stays focused on DAMON sysfs behavior and avoids depending on the
> local userspace cgroup mount layout.
Nice, thank you!
>
> Also compare the readback path while stripping only the trailing
> newline.
>
> Signed-off-by: niecheng <niecheng1@uniontech.com>
> ---
> tools/testing/selftests/damon/sysfs.py | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
> index 3aa5c91548a5..b595da24f698 100755
> --- a/tools/testing/selftests/damon/sysfs.py
> +++ b/tools/testing/selftests/damon/sysfs.py
> @@ -33,6 +33,7 @@ def assert_true(condition, expectation, status):
> if condition is not True:
> fail(expectation, status)
>
> +
> def assert_watermarks_committed(watermarks, dump):
> wmark_metric_val = {
> 'none': 0,
> @@ -90,8 +91,14 @@ def assert_filter_committed(filter_, dump):
> assert_true(filter_.type_ == dump['type'], 'type', dump)
> assert_true(filter_.matching == dump['matching'], 'matching', dump)
> assert_true(filter_.allow == dump['allow'], 'allow', dump)
> - # TODO: check memcg_path and memcg_id if type is memcg
> - if filter_.type_ == 'addr':
> + if filter_.type_ == 'memcg':
> + shown, rd_err = _damon_sysfs.read_file(
> + os.path.join(filter_.sysfs_dir(), 'memcg_path'))
> + if rd_err is not None:
> + fail('memcg_path sysfs read', {'error': rd_err})
> + assert_true(shown.rstrip('\n') == ('%s' % filter_.memcg_path),
> + 'memcg_path_sysfs', dump)
> + elif filter_.type_ == 'addr':
> assert_true([filter_.addr_start, filter_.addr_end] ==
> dump['addr_range'], 'addr_range', dump)
> elif filter_.type_ == 'target':
But this is in the middle of assert_filter_committed(). As the name says, this
is for validating if the user inputs are passed to DAMON internal. I think
this is not the right place to test its 'staging' functionality.
> @@ -258,6 +265,8 @@ def main():
> ops_filters=[
> _damon_sysfs.DamosFilter(type_='anon', matching=True,
> allow=True),
> + _damon_sysfs.DamosFilter(type_='memcg', matching=True,
> + allow=True, memcg_path='/'),
> ],
> )])
> context.idx = 0
What about adding another test case at the end of the main() function for the
validation of memcg string staging functionality?
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-05-28 14:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260528081039.1192194-1-niecheng1@uniontech.com>
2026-05-28 8:10 ` [PATCH 1/2] selftests/damon: fix DamosFilter memcg_path assignment niecheng
2026-05-28 14:17 ` SeongJae Park
2026-05-29 3:13 ` Cheng Nie
2026-05-28 8:10 ` [PATCH 2/2] selftests/damon: validate memcg filter sysfs readback niecheng
2026-05-28 14:28 ` SeongJae Park [this message]
2026-05-29 3:27 ` Cheng Nie
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=20260528142819.153573-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=kernel@uniontech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=niecheng1@uniontech.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
all inboxes | Powered by JetHome®