Skip to content

Commit e3e47ea

Browse files
sjp38hailmo-amzn
authored andcommitted
Docs/admin-guide/mm/damon/usage: link design document for DAMOS
The background and concept of DAMOS is redundantly documented, in the design document and the usage document. Replace the duplicated ones in usage document with links to the design document. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 7db40a9 commit e3e47ea

File tree

2 files changed

+51
-67
lines changed

2 files changed

+51
-67
lines changed

Documentation/admin-guide/mm/damon/usage.rst

Lines changed: 37 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,9 @@ be equal or smaller than ``start`` of directory ``N+1``.
257257
contexts/<N>/schemes/
258258
---------------------
259259

260-
For usual DAMON-based data access aware memory management optimizations, users
261-
would normally want the system to apply a memory management action to a memory
262-
region of a specific access pattern. DAMON receives such formalized operation
263-
schemes from the user and applies those to the target memory regions. Users
264-
can get and set the schemes by reading from and writing to files under this
265-
directory.
260+
The directory for DAMON-based Operation Schemes (:ref:`DAMOS
261+
<damon_design_damos>`). Users can get and set the schemes by reading from and
262+
writing to files under this directory.
266263

267264
In the beginning, this directory has only one file, ``nr_schemes``. Writing a
268265
number (``N``) to the file creates the number of child directories named ``0``
@@ -275,9 +272,9 @@ In each scheme directory, five directories (``access_pattern``, ``quotas``,
275272
``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file
276273
(``action``) exist.
277274

278-
The ``action`` file is for setting and getting what action you want to apply to
279-
memory regions having specific access pattern of the interest. The keywords
280-
that can be written to and read from the file and their meaning are as below.
275+
The ``action`` file is for setting and getting the scheme's :ref:`action
276+
<damon_design_damos_action>`. The keywords that can be written to and read
277+
from the file and their meaning are as below.
281278

282279
Note that support of each action depends on the running DAMON operations set
283280
:ref:`implementation <sysfs_contexts>`.
@@ -302,10 +299,8 @@ Note that support of each action depends on the running DAMON operations set
302299
schemes/<N>/access_pattern/
303300
---------------------------
304301

305-
The target access pattern of each DAMON-based operation scheme is constructed
306-
with three ranges including the size of the region in bytes, number of
307-
monitored accesses per aggregate interval, and number of aggregated intervals
308-
for the age of the region.
302+
The directory for the target access :ref:`pattern
303+
<damon_design_damos_access_pattern>` of the given DAMON-based operation scheme.
309304

310305
Under the ``access_pattern`` directory, three directories (``sz``,
311306
``nr_accesses``, and ``age``) each having two files (``min`` and ``max``)
@@ -316,42 +311,29 @@ to and reading from the ``min`` and ``max`` files under ``sz``,
316311
schemes/<N>/quotas/
317312
-------------------
318313

319-
Optimal ``target access pattern`` for each ``action`` is workload dependent, so
320-
not easy to find. Worse yet, setting a scheme of some action too aggressive
321-
can cause severe overhead. To avoid such overhead, users can limit time and
322-
size quota for each scheme. In detail, users can ask DAMON to try to use only
323-
up to specific time (``time quota``) for applying the action, and to apply the
324-
action to only up to specific amount (``size quota``) of memory regions having
325-
the target access pattern within a given time interval (``reset interval``).
326-
327-
When the quota limit is expected to be exceeded, DAMON prioritizes found memory
328-
regions of the ``target access pattern`` based on their size, access frequency,
329-
and age. For personalized prioritization, users can set the weights for the
330-
three properties.
314+
The directory for the :ref:`quotas <damon_design_damos_quotas>` of the given
315+
DAMON-based operation scheme.
331316

332317
Under ``quotas`` directory, three files (``ms``, ``bytes``,
333318
``reset_interval_ms``) and one directory (``weights``) having three files
334319
(``sz_permil``, ``nr_accesses_permil``, and ``age_permil``) in it exist.
335320

336321
You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, and
337322
``reset interval`` in milliseconds by writing the values to the three files,
338-
respectively. You can also set the prioritization weights for size, access
339-
frequency, and age in per-thousand unit by writing the values to the three
340-
files under the ``weights`` directory.
323+
respectively. You can also set the :ref:`prioritization weights
324+
<damon_design_damos_quotas_prioritization>` for size, access frequency, and age
325+
in per-thousand unit by writing the values to the three files under the
326+
``weights`` directory.
341327

342328
schemes/<N>/watermarks/
343329
-----------------------
344330

345-
To allow easy activation and deactivation of each scheme based on system
346-
status, DAMON provides a feature called watermarks. The feature receives five
347-
values called ``metric``, ``interval``, ``high``, ``mid``, and ``low``. The
348-
``metric`` is the system metric such as free memory ratio that can be measured.
349-
If the metric value of the system is higher than the value in ``high`` or lower
350-
than ``low`` at the memoent, the scheme is deactivated. If the value is lower
351-
than ``mid``, the scheme is activated.
331+
The directory for the :ref:`watermarks <damon_design_damos_watermarks>` of the
332+
given DAMON-based operation scheme.
352333

353334
Under the watermarks directory, five files (``metric``, ``interval_us``,
354-
``high``, ``mid``, and ``low``) for setting each value exist. You can set and
335+
``high``, ``mid``, and ``low``) for setting the metric, the time interval
336+
between check of the metric, and the three watermarks exist. You can set and
355337
get the five values by writing to the files, respectively.
356338

357339
Keywords and meanings of those that can be written to the ``metric`` file are
@@ -365,12 +347,8 @@ The ``interval`` should written in microseconds unit.
365347
schemes/<N>/filters/
366348
--------------------
367349

368-
Users could know something more than the kernel for specific types of memory.
369-
In the case, users could do their own management for the memory and hence
370-
doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access
371-
pattern of the scheme and/or the monitoring regions for the purpose, but that
372-
can be inefficient in some cases. In such cases, users could set non-access
373-
pattern driven filters using files in this directory.
350+
The directory for the :ref:`filters <damon_design_damos_filters>` of the given
351+
DAMON-based operation scheme.
374352

375353
In the beginning, this directory has only one file, ``nr_filters``. Writing a
376354
number (``N``) to the file creates the number of child directories named ``0``
@@ -597,15 +575,10 @@ update.
597575
Schemes
598576
-------
599577

600-
For usual DAMON-based data access aware memory management optimizations, users
601-
would simply want the system to apply a memory management action to a memory
602-
region of a specific access pattern. DAMON receives such formalized operation
603-
schemes from the user and applies those to the target processes.
604-
605-
Users can get and set the schemes by reading from and writing to ``schemes``
606-
debugfs file. Reading the file also shows the statistics of each scheme. To
607-
the file, each of the schemes should be represented in each line in below
608-
form::
578+
Users can get and set the DAMON-based operation :ref:`schemes
579+
<damon_design_damos>` by reading from and writing to ``schemes`` debugfs file.
580+
Reading the file also shows the statistics of each scheme. To the file, each
581+
of the schemes should be represented in each line in below form::
609582

610583
<target access pattern> <action> <quota> <watermarks>
611584

@@ -614,8 +587,9 @@ You can disable schemes by simply writing an empty string to the file.
614587
Target Access Pattern
615588
~~~~~~~~~~~~~~~~~~~~~
616589

617-
The ``<target access pattern>`` is constructed with three ranges in below
618-
form::
590+
The target access :ref:`pattern <damon_design_damos_access_pattern>` of the
591+
scheme. The ``<target access pattern>`` is constructed with three ranges in
592+
below form::
619593

620594
min-size max-size min-acc max-acc min-age max-age
621595

@@ -628,9 +602,9 @@ closed interval.
628602
Action
629603
~~~~~~
630604

631-
The ``<action>`` is a predefined integer for memory management actions, which
632-
DAMON will apply to the regions having the target access pattern. The
633-
supported numbers and their meanings are as below.
605+
The ``<action>`` is a predefined integer for memory management :ref:`actions
606+
<damon_design_damos_action>`. The supported numbers and their meanings are as
607+
below.
634608

635609
- 0: Call ``madvise()`` for the region with ``MADV_WILLNEED``. Ignored if
636610
``target`` is ``paddr``.
@@ -646,10 +620,8 @@ supported numbers and their meanings are as below.
646620
Quota
647621
~~~~~
648622

649-
Optimal ``target access pattern`` for each ``action`` is workload dependent, so
650-
not easy to find. Worse yet, setting a scheme of some action too aggressive
651-
can cause severe overhead. To avoid such overhead, users can limit time and
652-
size quota for the scheme via the ``<quota>`` in below form::
623+
Users can set the :ref:`quotas <damon_design_damos_quotas>` of the given scheme
624+
via the ``<quota>`` in below form::
653625

654626
<ms> <sz> <reset interval> <priority weights>
655627

@@ -659,19 +631,17 @@ the action to memory regions of the ``target access pattern`` within the
659631
``<sz>`` bytes of memory regions within the ``<reset interval>``. Setting both
660632
``<ms>`` and ``<sz>`` zero disables the quota limits.
661633

662-
When the quota limit is expected to be exceeded, DAMON prioritizes found memory
663-
regions of the ``target access pattern`` based on their size, access frequency,
664-
and age. For personalized prioritization, users can set the weights for the
665-
three properties in ``<priority weights>`` in below form::
634+
For the :ref:`prioritization <damon_design_damos_quotas_prioritization>`, users
635+
can set the weights for the three properties in ``<priority weights>`` in below
636+
form::
666637

667638
<size weight> <access frequency weight> <age weight>
668639

669640
Watermarks
670641
~~~~~~~~~~
671642

672-
Some schemes would need to run based on current value of the system's specific
673-
metrics like free memory ratio. For such cases, users can specify watermarks
674-
for the condition.::
643+
Users can specify :ref:`watermarks <damon_design_damos_watermarks>` of the
644+
given scheme via ``<watermarks>`` in below form::
675645

676646
<metric> <check interval> <high mark> <middle mark> <low mark>
677647

Documentation/vm/damon/design.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ abstracted monitoring target memory area only for each of a user-specified time
218218
interval (``update interval``).
219219

220220

221+
.. _damon_design_damos:
222+
221223
Operation Schemes
222224
-----------------
223225

@@ -255,6 +257,8 @@ the access pattern of interest, and applies the user-desired operation actions
255257
to the regions as soon as found.
256258

257259

260+
.. _damon_design_damos_action:
261+
258262
Operation Action
259263
~~~~~~~~~~~~~~~~
260264

@@ -277,6 +281,8 @@ characteristics. Hence, DAMOS resets the age of regions when an action is
277281
applied to those.
278282

279283

284+
.. _damon_design_damos_access_pattern:
285+
280286
Target Access Pattern
281287
~~~~~~~~~~~~~~~~~~~~~
282288

@@ -288,6 +294,8 @@ region's three properties are in the ranges, DAMOS classifies it as one of the
288294
regions that the scheme is having an interest in.
289295

290296

297+
.. _damon_design_damos_quotas:
298+
291299
Quotas
292300
~~~~~~
293301

@@ -305,6 +313,8 @@ can use for applying the action, and/or a maximum bytes of memory regions that
305313
the action can be applied within a user-specified time duration.
306314

307315

316+
.. _damon_design_damos_quotas_prioritization:
317+
308318
Prioritization
309319
^^^^^^^^^^^^^^
310320

@@ -330,6 +340,8 @@ the weight will be respected are up to the underlying prioritization mechanism
330340
implementation.
331341

332342

343+
.. _damon_design_damos_watermarks:
344+
333345
Watermarks
334346
~~~~~~~~~~
335347

@@ -350,6 +362,8 @@ is also deactivated. In this case, the DAMON worker thread only periodically
350362
checks the watermarks and therefore incurs nearly zero overhead.
351363

352364

365+
.. _damon_design_damos_filters:
366+
353367
Filters
354368
~~~~~~~
355369

0 commit comments

Comments
 (0)