Re: [PATCH 2/2] mm/damon/tests/core-kunit: test PSI goal rounds under the temporal tuner

From: SJ Park

Date: Tue Sep 15 2026 - 20:21:51 EST


On Tue, 15 Sep 2026 08:09:37 +0200 Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:

> Exercise a PSI quota goal under the temporal tuner on its first
> round, its next measured round, and after a goal commit. Use
> ULONG_MAX as the target so the goal is not reached during the test.
> Then check that a measured round which does reach the target sets
> the quota to zero, and that the consist tuner keeps its quota over
> an unmeasured round.
>
> Without the previous patch, the first and the post-commit checks see
> a zero quota.

Thank you for adding this test.

>
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
> ---
> mm/damon/tests/core-kunit.h | 69 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 69 insertions(+)
>
> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index c01e6a75cadc..2b9b24ce7dad 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -889,6 +889,74 @@ static void damos_test_commit_quota_goal(struct kunit *test)
> });
> }
>
> +/*
> + * Unmeasured PSI goals must not disable the temporal quota.
> + * Keep sz * 10000 within a 32-bit unsigned long.
> + */
> +static void damos_test_set_effective_quota_temporal_psi(struct kunit *test)
> +{
[...]
> + /* fresh goal, first tuning round */
> + damos_set_effective_quota(c, s);
> + KUNIT_EXPECT_EQ(test, s->quota.esz, (unsigned long)SZ_64K);
> +
> + /* second round: last_psi_total is initialised now */
> + damos_set_effective_quota(c, s);
> + KUNIT_EXPECT_EQ(test, s->quota.esz, (unsigned long)SZ_64K);

So, this test depends on the memory pressure level of the testing system? I
concern if that could make the test result not very reliable. Maybe we could
split out the corner case handling logic to explicitly receive the current
memory PSI total time. For example, like what I suggested in the reply to the
first patch of this series. With it, we could build a kunit test for only the
target logic, without depending on the test system's status.


Thanks,
SJ

[...]