Re: [PATCH] mm/damon/tests/core-kunit: test damon_nr_accesses_mvsum()

From: Song Hu

Date: Sat Jul 11 2026 - 01:12:08 EST




于 2026年7月10日 GMT+08:00 22:02:37,SJ Park <sj@xxxxxxxxxx> 写道:
>On Fri, 10 Jul 2026 12:15:30 +0800 Song Hu <husong@xxxxxxxxxx> wrote:
>
>> damon_nr_accesses_mvsum() wraps damon_mvsum() with the monitoring
>> intervals of the context to compute the pseudo moving sum of a region's
>> access frequency, with a special case for when the whole aggregation
>> window remains. damon_mvsum() itself is already covered by
>> damon_test_mvsum(), but the wrapper is not.
>>
>> Add a table-driven KUnit test that exercises the full-window-remaining
>> boundary (with both reset and not-yet-reset nr_accesses), partially
>> elapsed windows, and the no-window-remaining case.
>
>Nice! Thank you!
>
>>
>> Signed-off-by: Song Hu <husong@xxxxxxxxxx>
>> ---
>> mm/damon/tests/core-kunit.h | 49 +++++++++++++++++++++++++++++++++++++
>> 1 file changed, 49 insertions(+)
>>
>> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
>> index 0124f83b39b8..8c030282a638 100644
>> --- a/mm/damon/tests/core-kunit.h
>> +++ b/mm/damon/tests/core-kunit.h
>> @@ -683,6 +683,54 @@ static void damon_test_mvsum(struct kunit *test)
>> }
>> }
>>
>> +/*
>> + * Test damon_nr_accesses_mvsum(), which wraps damon_mvsum() with the monitoring
>
>Please wrap lines [1] for 80 columns limit.

Hi SJ,

Thanks for your review. This was my mistake, and I will resolve it in the next patch version.

>
>> + * intervals of the context. With a sample interval of 1 and an aggregation
>> + * interval of 10, an aggregation window is 10 sample intervals long. Each row
>> + * below specifies the passed sample intervals, the next aggregation time in
>> + * sample intervals, the current and last nr_accesses of a region, and the
>> + * expected return value.
>> + */
>> +static void damon_test_nr_accesses_mvsum(struct kunit *test)
>> +{
>> + unsigned long input_expects[] = {
>> + /* passed, next_aggr, nr_accesses, last_nr_accesses, expect */
>> + 0, 10, 5, 3, 3, /* bp=10000: unreset nr_accesses ignored */
>
>I was bit confused what 'bp' means. Can we just drop 'bp=...:' part from the
>comment?
>

This explanation is just my personal guess. I will delete all uncertain content in the revised patch.

Thanks,
Song

>Also, let's keep the 80 columns limit.
>
>[...]
>
>Other than those, looks good to me!
>
>[1] https://docs.kernel.org/process/coding-style.html#breaking-long-lines-and-strings
>
>
>Thanks,
>SJ