Re: (sashiko review) [RFC PATCH 6/9] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing

SeongJae Park
2026-04-04T21:03:58Z

Dropped individuals from Cc list to reduce the traffic.

TL; DR: sashiko made a good suggestion to improve this patch. I will do so in
the next revision.

Forwarding sashiko review in a reply format with my inline
comments below, for details of my view and doing discussions
via mails if needed.

> # review url: https://sashiko.dev/#/patchset/20260404163943.89278-7-sj@kernel.org
> # start of sashiko.dev inline review
> commit 2c875b613d1b0d252222336af28714d95bf57930
> Author: SeongJae Park <sj@kernel.org>
>
> mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing
>
> This commit extends the damos_test_commit_quotas() kunit test to verify
> that damos_commit_quota() correctly copies the fail_charge_num and
> fail_charge_denom parameters.
>
> > diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> > index 9e5904c2beeb2..1eb70f721d1e1 100644
> > --- a/mm/damon/tests/core-kunit.h
> > +++ b/mm/damon/tests/core-kunit.h
> [ ... ]
> > @@ -717,6 +721,8 @@ static void damos_test_commit_quota(struct kunit *test)
> > KUNIT_EXPECT_EQ(test, dst.ms, src.ms);
> > KUNIT_EXPECT_EQ(test, dst.sz, src.sz);
> > KUNIT_EXPECT_EQ(test, dst.goal_tuner, src.goal_tuner);
> > + KUNIT_EXPECT_EQ(test, dst.fail_charge_num, 1);
> > + KUNIT_EXPECT_EQ(test, dst.fail_charge_denom, 1024);
>
> This isn't a bug, but should these assertions use src.fail_charge_num and
> src.fail_charge_denom instead of the hardcoded 1 and 1024?
>
> Using the src fields would keep this consistent with the surrounding
> assertions. It would also prevent the test from becoming brittle if the
> src structure's initialization values are changed in the future.

Makes sense, I will do so in the next revision.

Thanks,
SJ

>
> > KUNIT_EXPECT_EQ(test, dst.weight_sz, src.weight_sz);
> > KUNIT_EXPECT_EQ(test, dst.weight_nr_accesses, src.weight_nr_accesses);
> > KUNIT_EXPECT_EQ(test, dst.weight_age, src.weight_age);
>
>
> # end of sashiko.dev inline review
> # review url: https://sashiko.dev/#/patchset/20260404163943.89278-7-sj@kernel.org

# hkml [1] generated a draft of this mail. You can regenerate
# this using below command:
#
# hkml patch sashiko_dev --for_forwarding \
# 20260404163943.89278-7-sj@kernel.org
#
# [1] https://github.com/sjp38/hackermail