Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: SeongJae Park <sj@kernel.org>,
	damon@lists.linux.dev, Andrew Morton <akpm@linux-foundation.org>,
	Shu Anzai <shu17az@gmail.com>,
	Jiayuan Chen <jiayuan.chen@shopee.com>,
	Quanmin Yan <yanquanmin1@huawei.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] mm/damon/core: detect internal variation above max_nr_regions/2
Date: Mon, 25 May 2026 09:38:00 -0700	[thread overview]
Message-ID: <20260525163802.8667-1-sj@kernel.org> (raw)
In-Reply-To: <9cc396ae-da42-48ad-97d7-213208884ee5@linux.dev>

On Mon, 25 May 2026 16:09:42 +0800 Jiayuan Chen <jiayuan.chen@linux.dev> wrote:

> 
> On 5/23/26 9:43 AM, SeongJae Park wrote:
> > On Fri, 22 May 2026 23:11:47 +0800 Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
> >
> >> Hi, SJ
> >>
> >> On 5/22/26 10:42 AM, SeongJae Park wrote:
> >>> On Thu, 21 May 2026 23:07:11 +0800 Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
> >>>
> >>>> Hi SJ,
> >>>>
> >>>> Thanks for taking a look.  Quick replies inline.
> >>>>
> >>>>
> >>>> On 5/21/26 10:30 PM, SeongJae Park wrote:
> >>>>> Hello Jiayuan,
> >>>>>
> >>>>> On Thu, 21 May 2026 12:52:22 +0800 Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
> > [...]
> >>>> counter was just for convenience -- easier to cat a sysfs file than to wire
> >>>>
> >>>> up tracing.  Even the tracepoint covers it, It's cost to much for
> >>>> Grafana to just get
> >>>>
> >>>> a metrics by tracepoint.
> > Out of the scope of this patch series, but I'm interested in how you connect
> > DAMON outputs to Grafana.  I believe that could be useful for many people who
> > willing to get some fleet wide access pattern.  Maybe worthy to present to
> > wider audiences, like System monitoring microconf [1] at LPC?
> 
> Honestly it's nothing fancy -- we just export nr_regions as a Prometheus 
> metric because it's a
> 
> performance-relevant signal.
> 
> 
> Vsualizing access patterns is a real pain point.  I have a small 
> AI-written script that pulls region
> 
> data and turns it into a webpage I can open in the browser.  It's not 
> live like Grafana -- I just run it when I
> 
> want to look at the data.  I don't think Grafana has a component for 
> this kind of view anyway.

I agree it is difficult.  So, you are using DAMON for not data access pattern
obserrvability but access-aware system operations like proactive reclaim of
cold pages?

For Grafana integration, I'm trying to use idle time percentiels as the "format
for fleet-wide aggregation".  My previous talk [1] at LPC may give you more
details if you are interested in.

[...]
> > So I was thinking below as a suggestion.
> >
> > The basic idea is, choosing the number of regions to split based on the
> > remaining budget (max_nr_regions - nr_regions).  I'd prefer making this simple
> > and lightweight.  So suggesting something like below.
> >
> > void kdamond_split_regions()
> > {
> > 	static unsigned char rndseed;
> >
> > 	budget = max_nr_regions - current_nr_regions()
> > 	if (budget > max_nr_regions / 2)
> > 		split_step = 1
> > 	elif (budget > max_nr_regions / 3)
> > 		split_step = 2
> > 	...
> >
> > 	idx = rndseed++ % split_step;
> > 	for (; idx < current_nr_regions(), idx += split_step)
> > 		split_region(nth_region(idx));
> > }
> >
> > I think this might be similar to your downstream change, but what do you think,
> > Jiayuan?
> 
> 
> Yes, this is close to what we do downstream.  Roughly:
> 
>    void kdamond_split_regions()
>    {
>        budget = max_nr_regions - current_nr_regions()
>        if (budget == 0)
>            return
> 
>        split_step = current_nr_regions() / budget
> 
>        for_each_region(r)
>            if (get_random_u32_below(split_step) == 0)
>                split_region(r)
>    }
> 
> And I like your version better -- the step formula (max/budget) leaves
> a margin so it approaches max more smoothly. I'll try your approach first
> 
> and test it in our env.

Sounds good!  Please feel free to let me know if any help is needed :)

[...]

[1] https://lpc.events/event/19/contributions/2075/


Thanks,
SJ


      reply	other threads:[~2026-05-25 16:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  4:52 [PATCH 0/2] mm/damon/core: detect internal variation above max_nr_regions/2 Jiayuan Chen
2026-05-21  4:52 ` [PATCH 1/2] mm/damon/core: split age==0 regions when nr_regions exceeds max/2 Jiayuan Chen
2026-05-21  4:52 ` [PATCH 2/2] mm/damon/tests/core-kunit: test split above max_nr_regions/2 Jiayuan Chen
2026-05-21 14:30 ` [PATCH 0/2] mm/damon/core: detect internal variation " SeongJae Park
2026-05-21 15:07   ` Jiayuan Chen
2026-05-22  2:42     ` SeongJae Park
2026-05-22 15:11       ` Jiayuan Chen
2026-05-23  1:43         ` SeongJae Park
2026-05-25  8:09           ` Jiayuan Chen
2026-05-25 16:38             ` SeongJae Park [this message]

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=20260525163802.8667-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=jiayuan.chen@linux.dev \
    --cc=jiayuan.chen@shopee.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shu17az@gmail.com \
    --cc=yanquanmin1@huawei.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