Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Song Hu <husong@kylinos.cn>
Cc: SJ Park <sj@kernel.org>,
	akpm@linux-foundation.org, shu17az@gmail.com,
	jiayuan.chen@shopee.com, damon@lists.linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon/tests/core-kunit: test damon_nr_accesses_mvsum()
Date: Fri, 10 Jul 2026 07:02:37 -0700	[thread overview]
Message-ID: <20260710140238.24103-1-sj@kernel.org> (raw)
In-Reply-To: <20260710041530.557455-1-husong@kylinos.cn>

On Fri, 10 Jul 2026 12:15:30 +0800 Song Hu <husong@kylinos.cn> 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@kylinos.cn>
> ---
>  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.

> + * 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?

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


  reply	other threads:[~2026-07-10 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10  4:15 [PATCH] mm/damon/tests/core-kunit: test damon_nr_accesses_mvsum() Song Hu
2026-07-10 14:02 ` SJ Park [this message]
2026-07-11  5:11   ` Song Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260710140238.24103-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=husong@kylinos.cn \
    --cc=jiayuan.chen@shopee.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shu17az@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox