[PATCH v2 0/3] selftests/damon: misc fixes for test bugs

Kunwu Chan posted 3 patches 1 week ago
tools/testing/selftests/damon/_damon_sysfs.py        | 12 +++++++++---
.../testing/selftests/damon/damos_apply_interval.py  |  2 +-
tools/testing/selftests/damon/damos_quota_goal.py    |  2 +-
tools/testing/selftests/damon/damos_tried_regions.py |  4 ++--
.../selftests/damon/drgn_dump_damon_status.py        |  2 +-
tools/testing/selftests/damon/sysfs.py               |  4 ++--
tools/testing/selftests/damon/sysfs.sh               |  6 +++---
...fs_update_schemes_tried_regions_wss_estimation.py |  2 +-
8 files changed, 20 insertions(+), 14 deletions(-)
[PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 1 week ago
From: Kunwu Chan <chentao@kylinos.cn>

This series fixes several bugs in the DAMON selftests.  Most are
trivial but cause tests to silently pass when they shouldn't, or
fail prematurely on slow machines.

Patch 1 fixes mutable default arguments in DamonCtx.__init__()
that cause state to leak between test instances.

Patch 2 fixes wrong operator precedence and join TypeError in
damos_tried_regions.py.

Patch 3 fixes several wrong strings that produce dead elif
branches, skipped file existence checks, and broken dict key
lookups.

Based on next-20260529.
base-commit: 7da7f07112610a520567421dd2ffcb51beaefbcc
---
Changes in v2:
- Fix From:/Signed-off-by mismatch.
- Add Reviewed-by tags from SeongJae Park.
- Drop the duplicate memcg_path fix.
- Drop the empty aggregation-cycle retry fix pending root-cause
  investigation.
- No code change


Kunwu Chan (3):
  selftests/damon: prevent cross-context state pollution in DamonCtx
  selftests/damon/damos_tried_regions: fix expectation output and join
    TypeError
  selftests/damon: fix dead code, skipped checks, and broken lookups

 tools/testing/selftests/damon/_damon_sysfs.py        | 12 +++++++++---
 .../testing/selftests/damon/damos_apply_interval.py  |  2 +-
 tools/testing/selftests/damon/damos_quota_goal.py    |  2 +-
 tools/testing/selftests/damon/damos_tried_regions.py |  4 ++--
 .../selftests/damon/drgn_dump_damon_status.py        |  2 +-
 tools/testing/selftests/damon/sysfs.py               |  4 ++--
 tools/testing/selftests/damon/sysfs.sh               |  6 +++---
 ...fs_update_schemes_tried_regions_wss_estimation.py |  2 +-
 8 files changed, 20 insertions(+), 14 deletions(-)

-- 
2.43.0
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by SeongJae Park 6 days, 16 hours ago
On Mon,  1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:

> From: Kunwu Chan <chentao@kylinos.cn>
> 
> This series fixes several bugs in the DAMON selftests.  Most are
> trivial but cause tests to silently pass when they shouldn't, or
> fail prematurely on slow machines.
> 
> Patch 1 fixes mutable default arguments in DamonCtx.__init__()
> that cause state to leak between test instances.
> 
> Patch 2 fixes wrong operator precedence and join TypeError in
> damos_tried_regions.py.
> 
> Patch 3 fixes several wrong strings that produce dead elif
> branches, skipped file existence checks, and broken dict key
> lookups.
> 
> Based on next-20260529.
> base-commit: 7da7f07112610a520567421dd2ffcb51beaefbcc
> ---
> Changes in v2:
> - Fix From:/Signed-off-by mismatch.
> - Add Reviewed-by tags from SeongJae Park.
> - Drop the duplicate memcg_path fix.
> - Drop the empty aggregation-cycle retry fix pending root-cause
>   investigation.
> - No code change

From the next time, please add links to previous versions [1].  For other
readers, the v1 of this series is available on the mailing list [2].

[1] https://docs.kernel.org/process/submitting-patches.html#commentary
[2] https://lore.kernel.org/20260531085633.48626-1-kunwu.chan@linux.dev


Thanks,
SJ

[....]
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 5 days, 4 hours ago
2026年6月1日 22:28, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > 写到:


> 
> On Mon, 1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:
> 
> > 
> > From: Kunwu Chan <chentao@kylinos.cn>
> >  
> >  This series fixes several bugs in the DAMON selftests. Most are
> >  trivial but cause tests to silently pass when they shouldn't, or
> >  fail prematurely on slow machines.
> >  
> >  Patch 1 fixes mutable default arguments in DamonCtx.__init__()
> >  that cause state to leak between test instances.
> >  
> >  Patch 2 fixes wrong operator precedence and join TypeError in
> >  damos_tried_regions.py.
> >  
> >  Patch 3 fixes several wrong strings that produce dead elif
> >  branches, skipped file existence checks, and broken dict key
> >  lookups.
> >  
> >  Based on next-20260529.
> >  base-commit: 7da7f07112610a520567421dd2ffcb51beaefbcc
> >  ---
> >  Changes in v2:
> >  - Fix From:/Signed-off-by mismatch.
> >  - Add Reviewed-by tags from SeongJae Park.
> >  - Drop the duplicate memcg_path fix.
> >  - Drop the empty aggregation-cycle retry fix pending root-cause
> >  investigation.
> >  - No code change
> > 
> From the next time, please add links to previous versions [1]. For other
> readers, the v1 of this series is available on the mailing list [2].
> 
> [1] https://docs.kernel.org/process/submitting-patches.html#commentary
> [2] https://lore.kernel.org/20260531085633.48626-1-kunwu.chan@linux.dev
> 
Hi SJ,

Noted, will add the link to previous versions next time.
Thanks for the reminder and for providing the v1 link.

Regards,
Kunwu
> Thanks,
> SJ
> 
> [....]
>
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by SeongJae Park 6 days, 16 hours ago
On Mon,  1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:

> From: Kunwu Chan <chentao@kylinos.cn>
> 
> This series fixes several bugs in the DAMON selftests.  Most are
> trivial but cause tests to silently pass when they shouldn't, or
> fail prematurely on slow machines.

Nit.  Only patch 3 fixes a fake test pass for "avail_operations" file existence
test, and the series is not doing something for slow machines, right?  I think
the last sentence should be updated, for example:

'''
Most are trivial but makes test output wrong or even silently pass the one for
'avail_operation' file existence check.
'''

Other than that, all look good to me, and already have my Reviewed-by: tag.

Asssuming you are ok with the above change, I applied this series to damon/next
[1] tree with the above change.  If this series is not added to mm.git in short
term (~1 week?), I will ask mm.git maintainer (Andrew Morton) to pick this.
So, no action from your side is needed for now.  If it seems I also forgot
doing that or you cannot wait for my action, please feel free to directly ask
that to Andrew.

[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees


Thanks,
SJ

[...]
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 5 days, 4 hours ago
2026年6月1日 22:22, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > 写到:


> 
> On Mon, 1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:
> 
> > 
> > From: Kunwu Chan <chentao@kylinos.cn>
> >  
> >  This series fixes several bugs in the DAMON selftests. Most are
> >  trivial but cause tests to silently pass when they shouldn't, or
> >  fail prematurely on slow machines.
> > 
> Nit. Only patch 3 fixes a fake test pass for "avail_operations" file existence
> test, and the series is not doing something for slow machines, right? I think
> the last sentence should be updated, for example:
> 
> '''
> Most are trivial but makes test output wrong or even silently pass the one for
> 'avail_operation' file existence check.
> '''
> 
> Other than that, all look good to me, and already have my Reviewed-by: tag.
> 
> Asssuming you are ok with the above change, I applied this series to damon/next
> [1] tree with the above change. If this series is not added to mm.git in short
> term (~1 week?), I will ask mm.git maintainer (Andrew Morton) to pick this.
> So, no action from your side is needed for now. If it seems I also forgot
> doing that or you cannot wait for my action, please feel free to directly ask
> that to Andrew.
> 
> [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
> 
Hi SJ,

The updated cover letter looks good to me, thanks for fixing it.  
Thanks also for applying to damon/next.  
No further action needed on my side.

Regards,
Kunwu

> Thanks,
> SJ
> 
> [...]
>
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by SeongJae Park 5 days, 1 hour ago
On Wed, 03 Jun 2026 02:11:33 +0000 "Kunwu Chan" <kunwu.chan@linux.dev> wrote:

> 2026年6月1日 22:22, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > 写到:
> 
> 
> > 
> > On Mon, 1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:
> > 
> > > 
> > > From: Kunwu Chan <chentao@kylinos.cn>
> > >  
> > >  This series fixes several bugs in the DAMON selftests. Most are
> > >  trivial but cause tests to silently pass when they shouldn't, or
> > >  fail prematurely on slow machines.
> > > 
> > Nit. Only patch 3 fixes a fake test pass for "avail_operations" file existence
> > test, and the series is not doing something for slow machines, right? I think
> > the last sentence should be updated, for example:
> > 
> > '''
> > Most are trivial but makes test output wrong or even silently pass the one for
> > 'avail_operation' file existence check.
> > '''
> > 
> > Other than that, all look good to me, and already have my Reviewed-by: tag.
> > 
> > Asssuming you are ok with the above change, I applied this series to damon/next
> > [1] tree with the above change. If this series is not added to mm.git in short
> > term (~1 week?), I will ask mm.git maintainer (Andrew Morton) to pick this.

FYI, we are now quite close to next merge window.  We want to focus on making
mm.git more stabilized and therefore ready for the next merge window, rather
than adding more changes that no really urgent.  I understand this series is
not really urgent.  Hence, I will request adding this to mm.git after next -rc1
release.  Let me know if you think this is really  urgent.

> > So, no action from your side is needed for now. If it seems I also forgot
> > doing that or you cannot wait for my action, please feel free to directly ask
> > that to Andrew.
> > 
> > [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
> > 
> Hi SJ,
> 
> The updated cover letter looks good to me, thanks for fixing it.  
> Thanks also for applying to damon/next.  
> No further action needed on my side.

Thank you for confirming!


Thanks,
SJ

[...]
Re: [PATCH v2 0/3] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 4 days, 21 hours ago
2026年6月3日 13:02, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > 写到:


> 
> On Wed, 03 Jun 2026 02:11:33 +0000 "Kunwu Chan" <kunwu.chan@linux.dev> wrote:
> 
> > 
> > 2026年6月1日 22:22, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > 写到:
> >  
> >  
> >  
> >  On Mon, 1 Jun 2026 11:23:11 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:
> >  
> >  > 
> >  > From: Kunwu Chan <chentao@kylinos.cn>
> >  > 
> >  > This series fixes several bugs in the DAMON selftests. Most are
> >  > trivial but cause tests to silently pass when they shouldn't, or
> >  > fail prematurely on slow machines.
> >  > 
> >  Nit. Only patch 3 fixes a fake test pass for "avail_operations" file existence
> >  test, and the series is not doing something for slow machines, right? I think
> >  the last sentence should be updated, for example:
> >  
> >  '''
> >  Most are trivial but makes test output wrong or even silently pass the one for
> >  'avail_operation' file existence check.
> >  '''
> >  
> >  Other than that, all look good to me, and already have my Reviewed-by: tag.
> >  
> >  Asssuming you are ok with the above change, I applied this series to damon/next
> >  [1] tree with the above change. If this series is not added to mm.git in short
> >  term (~1 week?), I will ask mm.git maintainer (Andrew Morton) to pick this.
> > 
> FYI, we are now quite close to next merge window. We want to focus on making
> mm.git more stabilized and therefore ready for the next merge window, rather
> than adding more changes that no really urgent. I understand this series is
> not really urgent. Hence, I will request adding this to mm.git after next -rc1
> release. Let me know if you think this is really urgent.
> 
Waiting until after -rc1 is perfectly fine, this series isn't
urgent.  Thanks for letting me know.

Regards,
Kunwu

> > 
> > So, no action from your side is needed for now. If it seems I also forgot
> >  doing that or you cannot wait for my action, please feel free to directly ask
> >  that to Andrew.
> >  
> >  [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
> >  
> >  Hi SJ,
> >  
> >  The updated cover letter looks good to me, thanks for fixing it. 
> >  Thanks also for applying to damon/next. 
> >  No further action needed on my side.
> > 
> Thank you for confirming!
> 
> Thanks,
> SJ
> 
> [...]
>