mm/damon/sysfs: handle 'state' file inputs for every sampling interval if possible
authorSeongJae Park <sj@kernel.org>
Tue, 6 Feb 2024 02:51:58 +0000 (18:51 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 Feb 2024 18:24:55 +0000 (10:24 -0800)
commit6a080670d68834d22d47506033e8940b16da4322
tree83ad20bfdb3dc79ce84ac1666afb8c96e3e8df6b
parent831bc31a5e82dc189040111fa2ab2f81b8521a9b
mm/damon/sysfs: handle 'state' file inputs for every sampling interval if possible

DAMON sysfs interface need to access kdamond-touching data for some of
kdamond user commands.  It uses ->after_aggregation() kdamond callback to
safely access the data in the case.  It had to use the aggregation
interval callback because that was the only callback that users can access
complete monitoring results.

Since patch series "mm/damon: provide pseudo-moving sum based access
rate", which starts from commit 78fbfb155d20 ("mm/damon/core: define and
use a dedicated function for region access rate update"), DAMON provides
good-to-use quality moitoring results for every sampling interval.  It
aims to help users who need to quickly retrieve the monitoring results.
When the aggregation interval is set too long and therefore waiting for
the aggregation interval can degrade user experience, or when the access
pattern is expected to be significantly changed[1] could be such cases.

However, because DAMON sysfs interface is still handling the commands per
aggregation interval, the end user cannot get the benefit.  Update DAMON
sysfs interface to handle kdamond commands for every sampling interval if
applicable.  Specifically, all kdamond data accessing commands except
'commit' command are applicable.

[1] https://lore.kernel.org/r/20240129121316.GA9706@cuiyangpei

Link: https://lkml.kernel.org/r/20240206025158.203097-1-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: xiongping1 <xiongping1@xiaomi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs-common.h
mm/damon/sysfs-schemes.c
mm/damon/sysfs.c