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:06 +0000	[thread overview]
Message-ID: <20260601080307.0532A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <9FAF3DC4DEDDA72F+20260601074922.209222-1-niecheng1@uniontech.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test fails if CONFIG_MEMCG is disabled because stopping an unstarted kdamond returns an error, defeating the intent of ignoring start failures.
--

commit 82e2d2dc23cd1bb3cb389943f0bf754e63c68c96
Author: Cheng Nie <niecheng1@uniontech.com>

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

This commit adds a test to validate the staging readback of memcg_path in
DAMON sysfs without committing it. It configures the memcg filter, verifies
the readback, and attempts to ignore start() failures to avoid depending on
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():
> +    global kdamonds
> +    memcg_filter = _damon_sysfs.DamosFilter(
> +            type_='memcg', matching=True, allow=True, memcg_path='/')
> +    kdamonds = _damon_sysfs.Kdamonds(
> +            [_damon_sysfs.Kdamond(
> +                contexts=[_damon_sysfs.DamonCtx(
> +                    targets=[_damon_sysfs.DamonTarget(pid=-1)],
> +                    schemes=[_damon_sysfs.Damos(
> +                        ops_filters=[memcg_filter])],
> +                    )])])
> +    kdamonds.start()
[ ... ]
> +    err = kdamonds.stop()
> +    if err is not None:
> +        print('memcg_path staging: kdamond stop (%s)' % err)
> +        exit(1)

[Severity: Medium]
The commit message mentions ignoring start() failures so the test does not
depend on CONFIG_MEMCG or cgroup layout. However, if start() fails,
kdamonds.stop() will return an error because the kernel's
damon_sysfs_turn_damon_off() returns -EINVAL when kdamond->damon_ctx is
NULL.

Does this cause the test to exit(1) and fail anyway on environments without
CONFIG_MEMCG when checking the return value of stop() here?

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

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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  7:36 [PATCH v3 0/2] selftests/damon: fix memcg_path staging handling Cheng Nie
2026-06-01  7:48 ` [PATCH v3 1/2] selftests/damon/_damon_sysfs.py: fix memcg_path assignment 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 [this message]
2026-06-01  8:46     ` Cheng Nie
2026-06-01 14:33       ` SeongJae Park
2026-06-02  1:28         ` Cheng Nie
     [not found] <20260601073635.200015-1-niecheng1@uniontech.com>
2026-06-01  7:45 ` Cheng Nie
2026-06-01  8:03   ` sashiko-bot

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=20260601080307.0532A1F00893@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