Re: [PATCH 1/5] selftests/damon: prevent cross-context state pollution in DamonCtx

From: Kunwu Chan

Date: Sun May 31 2026 - 22:13:27 EST


June 1, 2026 at 12:30 AM, "SeongJae Park" <sj@xxxxxxxxxx mailto:sj@xxxxxxxxxx?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > wrote:


>
> On Sun, 31 May 2026 17:17:20 +0800 Kunwu Chan <kunwu.chan@xxxxxxxxx> wrote:
>
> >
> > From: Kunwu Chan <kunwu.chan@xxxxxxxxx>
> >
> > DamonCtx.__init__() uses mutable default values for
> > monitoring_attrs, targets, and schemes. In Python these are
> > evaluated once at function definition time, so multiple
> > DamonCtx instances can unintentionally share the same lists
> > and DamonAttrs instance.
> >
> > Replace the mutable defaults with None sentinels and
> > initialize the objects when needed.
> >
> Nice change, thank you!
>
Thanks, SJ.

> >
> > Co-developed-by: Wang Lian <lianux.mm@xxxxxxxxx>
> > Signed-off-by: Wang Lian <lianux.mm@xxxxxxxxx>
> > Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
> >
> checkpatch.pl complains as below:
>
> WARNING: From:/Signed-off-by: email address mismatch: 'From: Kunwu Chan <kunwu.chan@xxxxxxxxx>' != 'Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>'
>
> Other than that,
>
> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>
>

I'll fix the email mismatch and send a v2 to make the addresses consistent.

I'll also add your Reviewed-by tag.

Thanks,
Kunwu

> Thanks,
> SJ
>
> [...]
>