DAMON development mailing list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cheng Nie" <niecheng1@uniontech.com>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v3 2/2] selftests/damon/sysfs.py: validate memcg_path staging readback
Date: Mon, 01 Jun 2026 08:03:17 +0000	[thread overview]
Message-ID: <20260601080317.A0F121F00893@smtp.kernel.org> (raw)
In-Reply-To: <87B39E0F19A29319+20260601074533.205616-1-niecheng1@uniontech.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Test fails on teardown when `start()` fails, defeating the stated intent of decoupling the test from `CONFIG_MEMCG`.
--

commit 995afe8f607b12ca4f4469ac19ac53b1340cae11
Author: Cheng Nie <niecheng1@uniontech.com>

selftests/damon/sysfs.py: validate memcg_path staging readback

This commit adds a dedicated test to write memcg_path to sysfs and verify
the readback path. It intentionally ignores kdamonds.start() failures so
the test operates independently of CONFIG_MEMCG or cgroup layout.

> diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
> index aa03a1187489f..7a17ab88361bc 100755
> --- a/tools/testing/selftests/damon/sysfs.py
> +++ b/tools/testing/selftests/damon/sysfs.py
> @@ -250,6 +250,38 @@ def assert_ctxs_committed(kdamonds):
[ ... ]
> +def test_memcg_filter_memcg_path_staging():
[ ... ]
> +    kdamonds.start()
> +
> +    shown, rd_err = _damon_sysfs.read_file(
> +            os.path.join(memcg_filter.sysfs_dir(), 'memcg_path'))
> +    if rd_err is not None:
> +        print('memcg_path staging: sysfs read (%s)' % rd_err)
> +        kdamonds.stop()
> +        exit(1)
> +    if shown.rstrip('\n') != memcg_filter.memcg_path:
> +        print('memcg_path staging: memcg_path readback '
> +              '(shown=%s, expected=%s)' %
> +              (shown.rstrip('\n'), memcg_filter.memcg_path))
> +        kdamonds.stop()
> +        exit(1)
> +
> +    err = kdamonds.stop()
> +    if err is not None:
> +        print('memcg_path staging: kdamond stop (%s)' % err)
> +        exit(1)

[Severity: Medium]
If start() fails as expected when CONFIG_MEMCG is disabled, won't this
subsequent call to kdamonds.stop() return an error?

Writing 'off' to the 'state' sysfs file of an unstarted kdamond causes
damon_sysfs_turn_damon_off() to unconditionally return -EINVAL. This error
propagates back to the Python script via write_file(), causing the script
to exit with status 1.

Does checking this error and exiting with a failure defeat the stated intent
of ignoring the start() failure in the first place?

> +    kdamonds = None
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260601073635.200015-1-niecheng1@uniontech.com?part=2

  reply	other threads:[~2026-06-01  8:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260601073635.200015-1-niecheng1@uniontech.com>
2026-06-01  7:42 ` [PATCH v3 1/2] selftests/damon/_damon_sysfs.py: fix memcg_path assignment Cheng Nie
2026-06-01  7:44 ` Cheng Nie
2026-06-01  8:00   ` Cheng Nie
2026-06-01  7:45 ` [PATCH v3 2/2] selftests/damon/sysfs.py: validate memcg_path staging readback Cheng Nie
2026-06-01  8:03   ` sashiko-bot [this message]
2026-06-01  7:36 [PATCH v3 0/2] selftests/damon: fix memcg_path staging handling Cheng Nie
2026-06-01  7:49 ` [PATCH v3 2/2] selftests/damon/sysfs.py: validate memcg_path staging readback Cheng Nie
2026-06-01  8:03   ` sashiko-bot
2026-06-01  8:46     ` Cheng Nie
2026-06-01 14:33       ` SeongJae Park
2026-06-02  1:28         ` 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=20260601080317.A0F121F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=niecheng1@uniontech.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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