* [PATCH 0/4] mm/damon/sysfs: support periodic and automated stats update
@ 2025-07-17 5:54 SeongJae Park
2025-07-17 5:54 ` [PATCH 3/4] Docs/admin-guide/mm/damon/usage: document refresh_ms file SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: SeongJae Park @ 2025-07-17 5:54 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, kernel-team, linux-doc,
linux-kernel, linux-mm
DAMON sysfs interface provides files for reading DAMON internal status
including auto-tuned monitoring intervals, DAMOS stats, DAMOS action
applied regions, and auto-tuned DAMOS effective quota. Among those,
auto-tuned monitoring intervals, DAMOS stats and auto-tuned DAMOS
effective quota are essential for common DAMON/S use cases.
The content of the files are not automatically updated, though. Users
should manually request updates of the contents by writing a special
command to 'state' file of each kdamond directory. This interface is
good for minimizing overhead, but causes the below problems.
First, the usage is cumbersome. This is arguably not a big problem,
since the user-space tool (damo) can do this instead of the user.
Second, it can be too slow. The update request is not directly handled
by the sysfs interface but kdamond thread. And kdamond threads wake up
only once per the sampling interval. Hence if sampling interval is not
short, each update request could take too long time. The recommended
sampling interval setup is asking DAMON to automatically tune it, within
a range between 5 milliseconds and 10 seconds. On production systems it
is not very rare to have a few seconds sampling interval as a result of
the auto-tuning, so this can disturb observing DAMON internal status.
Finally, parallel update requests can conflict with each other. When
parallel update requests are received, DAMON sysfs interface simply
returns -EBUSY to one of the requests. DAMON user-space tool is hence
implementing its own backoff mechanism, but this can make the operation
even slower.
Introduce a new sysfs file, namely refresh_ms, for asking DAMON sysfs
interface to repeat the update of the above mentioned essential contents
with a user-specified time delay. If non-zero value is written to the
file, DAMON sysfs interface does the updates for essential DAMON
internal status including auto-tuned monitoring intervals, DAMOS stats,
and auto-tuned DAMOS quotas using the user-written value as the time
delay. In other words, it is similar to periodically writing
'update_schemes_stats', 'update_schemes_effective_quotas', and
'update_tuned_intervals' keywords to the 'state' file. If zero is
written to the file, the automatic refresh is disabled.
Changes from RFC
(https://lore.kernel.or/20250712204650.155988-1-sj@kernel.org)
- Wordsmith cover letter to clarify what are updated
SeongJae Park (4):
mm/damon/sysfs: implement refresh_ms file under kdamond directory
mm/damon/sysfs: implement refresh_ms file internal work
Docs/admin-guide/mm/damon/usage: document refresh_ms file
Docs/ABI/damon: update for refresh_ms
.../ABI/testing/sysfs-kernel-mm-damon | 7 +++
Documentation/admin-guide/mm/damon/usage.rst | 13 ++++-
mm/damon/sysfs.c | 58 +++++++++++++++++++
3 files changed, 75 insertions(+), 3 deletions(-)
base-commit: 2951e548fd2e489bdaecf326e1c3d17d4b5663fe
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 3/4] Docs/admin-guide/mm/damon/usage: document refresh_ms file
2025-07-17 5:54 [PATCH 0/4] mm/damon/sysfs: support periodic and automated stats update SeongJae Park
@ 2025-07-17 5:54 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2025-07-17 5:54 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, kernel-team, linux-doc,
linux-kernel, linux-mm
Document the new DAMON sysfs file, refresh_ms, on the usage document.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index fc5c962353ed..ff3a2dda1f02 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -59,7 +59,7 @@ comma (",").
:ref:`/sys/kernel/mm/damon <sysfs_root>`/admin
│ :ref:`kdamonds <sysfs_kdamonds>`/nr_kdamonds
- │ │ :ref:`0 <sysfs_kdamond>`/state,pid
+ │ │ :ref:`0 <sysfs_kdamond>`/state,pid,refresh_ms
│ │ │ :ref:`contexts <sysfs_contexts>`/nr_contexts
│ │ │ │ :ref:`0 <sysfs_context>`/avail_operations,operations
│ │ │ │ │ :ref:`monitoring_attrs <sysfs_monitoring_attrs>`/
@@ -123,8 +123,8 @@ kdamond.
kdamonds/<N>/
-------------
-In each kdamond directory, two files (``state`` and ``pid``) and one directory
-(``contexts``) exist.
+In each kdamond directory, three files (``state``, ``pid`` and ``refresh_ms``)
+and one directory (``contexts``) exist.
Reading ``state`` returns ``on`` if the kdamond is currently running, or
``off`` if it is not running.
@@ -161,6 +161,13 @@ Users can write below commands for the kdamond to the ``state`` file.
If the state is ``on``, reading ``pid`` shows the pid of the kdamond thread.
+Users can ask the kernel to periodically update files showing auto-tuned
+parameters and DAMOS stats instead of manually writing
+``update_tuned_intervals`` like keywords to ``state`` file. For this, users
+should write the desired update time interval in milliseconds to ``refresh_ms``
+file. If the interval is zero, the periodic update is disabled. Reading the
+file shows currently set time interval.
+
``contexts`` directory contains files for controlling the monitoring contexts
that this kdamond will execute.
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-17 5:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 5:54 [PATCH 0/4] mm/damon/sysfs: support periodic and automated stats update SeongJae Park
2025-07-17 5:54 ` [PATCH 3/4] Docs/admin-guide/mm/damon/usage: document refresh_ms file SeongJae Park
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).