From: cuiyangpei <cuiyangpei@gmail.com>
To: SeongJae Park <sj38.park@gmail.com>,
sj@kernel.org, akpm@linux-foundation.org, damon@lists.linux.dev,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: xiongping1@xiaomi.com
Subject: Re: [PATCH 1/2] mm/damon/sysfs: Implement recording feature
Date: Sun, 28 Jan 2024 17:13:00 +0800 [thread overview]
Message-ID: <ZbYanPU16klwz0HA@cyp-ubuntu> (raw)
In-Reply-To: <20240126080454.15649-1-sj@kernel.org>
On Fri, Jan 26, 2024 at 12:04:54AM -0800, SeongJae Park wrote:
> On Fri, 26 Jan 2024 14:57:06 +0800 cuiyangpei <cuiyangpei@gmail.com> wrote:
>
> > On Mon, Jan 22, 2024 at 09:56:11AM -0800, SeongJae Park wrote:
> > > Hi cuiyangpei,
> > >
> > > On Mon, 22 Jan 2024 13:46:31 +0800 cuiyangpei <cuiyangpei@gmail.com> wrote:
> > >
> > > > On Sun, Dec 03, 2023 at 07:37:45PM +0000, SeongJae Park wrote:
> > > > > On 2023-12-03T13:43:13+08:00 cuiyangpei <cuiyangpei@gmail.com> wrote:
> > > > >
> > > > > > On Fri, Dec 01, 2023 at 05:31:12PM +0000, SeongJae Park wrote:
> > > > > > > Hi Cuiyangpei,
> > > > > > >
> > > > > > > On Fri, 1 Dec 2023 20:25:07 +0800 cuiyangpei <cuiyangpei@gmail.com> wrote:
> > > > > > >
> > > > > > > > On Thu, Nov 30, 2023 at 07:44:20PM +0000, SeongJae Park wrote:
> > > > > > > > > Hi Cuiyangpei,
> > > > > > > > >
> > > > > > > > > On Thu, 30 Nov 2023 17:14:26 +0800 cuiyangpei <cuiyangpei@gmail.com> wrote:
> [...]
> > > > Is there any way to catch sampling result immediately after setting the
> > > > "update_schemes_tried_regions" state?
> > >
> > > There is no way for exactly doing this. You would need to proactively collect
> > > snapshots while the app is foreground, and use the latest one that collected
> > > before the app goes background, like recording-based approach would do.
> > >
> > > I think recent DAMON changes might make an alternative approach available,
> > > though. From v6.7, DAMON provides pseudo-moving-average monitoring result in
> > > sampling interval granualrity, since patchset "mm/damon: provide pseudo-moving
> > > sum based access rate". And a followup patchset, namely "mm/damon: implement
> > > DAMOS apply intervals", has made DAMOS works in the sampling interval
> > > granualrity. Both patchsets are merged into v6.7-rc1.
> > >
> > > Hence, I think you could use 'update_schemes_tried_regions' after you noticed
> > > the app's state transition, with DAMOS apply interval of one sampling interval.
> > > Then you will get the monitoring results after one sampling interval. Of
> > > course, the snapshot may contain some of background access pattern, but
> > > wouldn't made it changed significantly, unless you set aggregation interval too
> > > short.
> >
> > All other actions will apply at one sampling interval except for the
> > `stat` action.
> >
> > We use 'update_schemes_tried_regions' after switch to the background. The
> > before_damos_apply callback function will only be set when the next aggregation
> > interval arrives. The `tried_regions` will only be updated after setting the
> > callback function.
> >
> > DAMON is still sampling during setting 'update_schemes_tried_regions' to the next
> > aggregation time, which is not what we expected. The pseudo-moving-average
> > monitoring result can reduce nr_accesees inaccuracy, but age is still being modified
> > during this time, so it can't improve this issue.
> >
> > Please let me know if my understanding is incorrect. Thank you.
>
> So, 'update_schemes_tried_regions' command is firstly handled by
> 'damon_sysfs_cmd_request_callback()', which is registered as
> after_wmarks_check() and after_aggregation() callback. Hence
> 'update_schemes_tried_regions' command is still effectively working in
> aggregation interval granularity. I think this is what you found, right?
>
Yes.
> If I'm not wrongly understanding your point, I think the concern is valid. I
> think we should make it works in sampling interval granularity. I will try to
> make so. Would that work for your use case?
>
It's much better than working in aggregation interval.
I have a question. Why does the 'update_schemes_tried_regions' command need to work
in the sampling time or aggregation time? 'update_schemes_tried_regions' is a
relatively special state that updates the regions that corresponding operation scheme.
Can it be separated from other states and controlled by sysfs node to respond immediately
after being written?
> > >
> > > > Alternatively, can it return the "last_nr_accesses" and "last_age" values in
> > > > tried_regions/<N> directory?
> > >
> > > This could also be a good alternative in my think. Nice idea. But, because
> > > the previously mentioned alternative is already available while this require a
> > > bit small but additional changes, could we check if the previously one make
> > > sense and works first? We could revisit this idea if it turns out the previous
> > > alternative is not suffice in my opinion.
> > >
> > Can you consider adding "last_nr_accesses" and "last_age" two files in
> > 'tried_regions/<N>' directory?
>
> Actually we don't have 'last_age' field, right? And in case of
> 'last_nr_accesses', it is a hidden private field, since it is intended to be
> accessed by only DAMON core code. Making it exposed to user means exposing
> implementation details, and the mechanism that coupled with an exposed
> interface is hard to be changed, so be unflexible. Hence I'd prefer making
> 'update_schemes_tried_regions' works in sampling interval granularity, more
> than exposing the two information if it works for your use case.
>
Ok, I get it.
> Thanks,
> SJ
>
> [...]
next prev parent reply other threads:[~2024-01-28 9:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 7:34 [PATCH 1/2] mm/damon/sysfs: Implement recording feature cuiyangpei
2023-11-28 7:34 ` [PATCH 2/2] mm/damon/core: add sysfs nodes to set last_nr_accesses weight cuiyangpei
2023-11-28 16:11 ` [PATCH 1/2] mm/damon/sysfs: Implement recording feature kernel test robot
2023-11-28 16:21 ` kernel test robot
2023-11-28 18:57 ` SeongJae Park
2023-11-29 13:13 ` cuiyangpei
2023-11-29 17:10 ` SeongJae Park
2023-11-30 9:14 ` cuiyangpei
2023-11-30 19:44 ` SeongJae Park
2023-12-01 12:25 ` cuiyangpei
2023-12-01 17:31 ` SeongJae Park
2023-12-03 5:43 ` cuiyangpei
2023-12-03 19:37 ` SeongJae Park
2024-01-22 5:46 ` cuiyangpei
2024-01-22 17:56 ` SeongJae Park
2024-01-26 6:57 ` cuiyangpei
2024-01-26 8:04 ` SeongJae Park
2024-01-28 9:13 ` cuiyangpei [this message]
2024-01-28 16:28 ` SeongJae Park
2024-01-29 12:13 ` cuiyangpei
2024-02-06 2:56 ` SeongJae Park
2024-02-06 3:26 ` cuiyangpei
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=ZbYanPU16klwz0HA@cyp-ubuntu \
--to=cuiyangpei@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj38.park@gmail.com \
--cc=sj@kernel.org \
--cc=xiongping1@xiaomi.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;
as well as URLs for NNTP newsgroup(s).