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/20230616191742.87531-6-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
SeongJae Park 2023-06-16 19:17:40 +00:00 committed by Andrew Morton
parent ddb7d012b1
commit 01e08737da
2 changed files with 51 additions and 67 deletions

View File

@ -257,12 +257,9 @@ be equal or smaller than ``start`` of directory ``N+1``.
contexts/<N>/schemes/ contexts/<N>/schemes/
--------------------- ---------------------
For usual DAMON-based data access aware memory management optimizations, users The directory for DAMON-based Operation Schemes (:ref:`DAMOS
would normally want the system to apply a memory management action to a memory <damon_design_damos>`). Users can get and set the schemes by reading from and
region of a specific access pattern. DAMON receives such formalized operation writing to files under this directory.
schemes from the user and applies those to the target memory regions. Users
can get and set the schemes by reading from and writing to files under this
directory.
In the beginning, this directory has only one file, ``nr_schemes``. Writing a In the beginning, this directory has only one file, ``nr_schemes``. Writing a
number (``N``) to the file creates the number of child directories named ``0`` 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``,
``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file ``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file
(``action``) exist. (``action``) exist.
The ``action`` file is for setting and getting what action you want to apply to The ``action`` file is for setting and getting the scheme's :ref:`action
memory regions having specific access pattern of the interest. The keywords <damon_design_damos_action>`. The keywords that can be written to and read
that can be written to and read from the file and their meaning are as below. from the file and their meaning are as below.
Note that support of each action depends on the running DAMON operations set Note that support of each action depends on the running DAMON operations set
:ref:`implementation <sysfs_contexts>`. :ref:`implementation <sysfs_contexts>`.
@ -302,10 +299,8 @@ Note that support of each action depends on the running DAMON operations set
schemes/<N>/access_pattern/ schemes/<N>/access_pattern/
--------------------------- ---------------------------
The target access pattern of each DAMON-based operation scheme is constructed The directory for the target access :ref:`pattern
with three ranges including the size of the region in bytes, number of <damon_design_damos_access_pattern>` of the given DAMON-based operation scheme.
monitored accesses per aggregate interval, and number of aggregated intervals
for the age of the region.
Under the ``access_pattern`` directory, three directories (``sz``, Under the ``access_pattern`` directory, three directories (``sz``,
``nr_accesses``, and ``age``) each having two files (``min`` and ``max``) ``nr_accesses``, and ``age``) each having two files (``min`` and ``max``)
@ -316,18 +311,8 @@ to and reading from the ``min`` and ``max`` files under ``sz``,
schemes/<N>/quotas/ schemes/<N>/quotas/
------------------- -------------------
Optimal ``target access pattern`` for each ``action`` is workload dependent, so The directory for the :ref:`quotas <damon_design_damos_quotas>` of the given
not easy to find. Worse yet, setting a scheme of some action too aggressive DAMON-based operation scheme.
can cause severe overhead. To avoid such overhead, users can limit time and
size quota for each scheme. In detail, users can ask DAMON to try to use only
up to specific time (``time quota``) for applying the action, and to apply the
action to only up to specific amount (``size quota``) of memory regions having
the target access pattern within a given time interval (``reset interval``).
When the quota limit is expected to be exceeded, DAMON prioritizes found memory
regions of the ``target access pattern`` based on their size, access frequency,
and age. For personalized prioritization, users can set the weights for the
three properties.
Under ``quotas`` directory, three files (``ms``, ``bytes``, Under ``quotas`` directory, three files (``ms``, ``bytes``,
``reset_interval_ms``) and one directory (``weights``) having three files ``reset_interval_ms``) and one directory (``weights``) having three files
@ -335,23 +320,20 @@ Under ``quotas`` directory, three files (``ms``, ``bytes``,
You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, and You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, and
``reset interval`` in milliseconds by writing the values to the three files, ``reset interval`` in milliseconds by writing the values to the three files,
respectively. You can also set the prioritization weights for size, access respectively. You can also set the :ref:`prioritization weights
frequency, and age in per-thousand unit by writing the values to the three <damon_design_damos_quotas_prioritization>` for size, access frequency, and age
files under the ``weights`` directory. in per-thousand unit by writing the values to the three files under the
``weights`` directory.
schemes/<N>/watermarks/ schemes/<N>/watermarks/
----------------------- -----------------------
To allow easy activation and deactivation of each scheme based on system The directory for the :ref:`watermarks <damon_design_damos_watermarks>` of the
status, DAMON provides a feature called watermarks. The feature receives five given DAMON-based operation scheme.
values called ``metric``, ``interval``, ``high``, ``mid``, and ``low``. The
``metric`` is the system metric such as free memory ratio that can be measured.
If the metric value of the system is higher than the value in ``high`` or lower
than ``low`` at the memoent, the scheme is deactivated. If the value is lower
than ``mid``, the scheme is activated.
Under the watermarks directory, five files (``metric``, ``interval_us``, Under the watermarks directory, five files (``metric``, ``interval_us``,
``high``, ``mid``, and ``low``) for setting each value exist. You can set and ``high``, ``mid``, and ``low``) for setting the metric, the time interval
between check of the metric, and the three watermarks exist. You can set and
get the five values by writing to the files, respectively. get the five values by writing to the files, respectively.
Keywords and meanings of those that can be written to the ``metric`` file are 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.
schemes/<N>/filters/ schemes/<N>/filters/
-------------------- --------------------
Users could know something more than the kernel for specific types of memory. The directory for the :ref:`filters <damon_design_damos_filters>` of the given
In the case, users could do their own management for the memory and hence DAMON-based operation scheme.
doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access
pattern of the scheme and/or the monitoring regions for the purpose, but that
can be inefficient in some cases. In such cases, users could set non-access
pattern driven filters using files in this directory.
In the beginning, this directory has only one file, ``nr_filters``. Writing a In the beginning, this directory has only one file, ``nr_filters``. Writing a
number (``N``) to the file creates the number of child directories named ``0`` number (``N``) to the file creates the number of child directories named ``0``
@ -597,15 +575,10 @@ update.
Schemes Schemes
------- -------
For usual DAMON-based data access aware memory management optimizations, users Users can get and set the DAMON-based operation :ref:`schemes
would simply want the system to apply a memory management action to a memory <damon_design_damos>` by reading from and writing to ``schemes`` debugfs file.
region of a specific access pattern. DAMON receives such formalized operation Reading the file also shows the statistics of each scheme. To the file, each
schemes from the user and applies those to the target processes. of the schemes should be represented in each line in below form::
Users can get and set the schemes by reading from and writing to ``schemes``
debugfs file. Reading the file also shows the statistics of each scheme. To
the file, each of the schemes should be represented in each line in below
form::
<target access pattern> <action> <quota> <watermarks> <target access pattern> <action> <quota> <watermarks>
@ -614,8 +587,9 @@ You can disable schemes by simply writing an empty string to the file.
Target Access Pattern Target Access Pattern
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The ``<target access pattern>`` is constructed with three ranges in below The target access :ref:`pattern <damon_design_damos_access_pattern>` of the
form:: scheme. The ``<target access pattern>`` is constructed with three ranges in
below form::
min-size max-size min-acc max-acc min-age max-age min-size max-size min-acc max-acc min-age max-age
@ -628,9 +602,9 @@ closed interval.
Action Action
~~~~~~ ~~~~~~
The ``<action>`` is a predefined integer for memory management actions, which The ``<action>`` is a predefined integer for memory management :ref:`actions
DAMON will apply to the regions having the target access pattern. The <damon_design_damos_action>`. The supported numbers and their meanings are as
supported numbers and their meanings are as below. below.
- 0: Call ``madvise()`` for the region with ``MADV_WILLNEED``. Ignored if - 0: Call ``madvise()`` for the region with ``MADV_WILLNEED``. Ignored if
``target`` is ``paddr``. ``target`` is ``paddr``.
@ -646,10 +620,8 @@ supported numbers and their meanings are as below.
Quota Quota
~~~~~ ~~~~~
Optimal ``target access pattern`` for each ``action`` is workload dependent, so Users can set the :ref:`quotas <damon_design_damos_quotas>` of the given scheme
not easy to find. Worse yet, setting a scheme of some action too aggressive via the ``<quota>`` in below form::
can cause severe overhead. To avoid such overhead, users can limit time and
size quota for the scheme via the ``<quota>`` in below form::
<ms> <sz> <reset interval> <priority weights> <ms> <sz> <reset interval> <priority weights>
@ -659,19 +631,17 @@ the action to memory regions of the ``target access pattern`` within the
``<sz>`` bytes of memory regions within the ``<reset interval>``. Setting both ``<sz>`` bytes of memory regions within the ``<reset interval>``. Setting both
``<ms>`` and ``<sz>`` zero disables the quota limits. ``<ms>`` and ``<sz>`` zero disables the quota limits.
When the quota limit is expected to be exceeded, DAMON prioritizes found memory For the :ref:`prioritization <damon_design_damos_quotas_prioritization>`, users
regions of the ``target access pattern`` based on their size, access frequency, can set the weights for the three properties in ``<priority weights>`` in below
and age. For personalized prioritization, users can set the weights for the form::
three properties in ``<priority weights>`` in below form::
<size weight> <access frequency weight> <age weight> <size weight> <access frequency weight> <age weight>
Watermarks Watermarks
~~~~~~~~~~ ~~~~~~~~~~
Some schemes would need to run based on current value of the system's specific Users can specify :ref:`watermarks <damon_design_damos_watermarks>` of the
metrics like free memory ratio. For such cases, users can specify watermarks given scheme via ``<watermarks>`` in below form::
for the condition.::
<metric> <check interval> <high mark> <middle mark> <low mark> <metric> <check interval> <high mark> <middle mark> <low mark>

View File

@ -218,6 +218,8 @@ abstracted monitoring target memory area only for each of a user-specified time
interval (``update interval``). interval (``update interval``).
.. _damon_design_damos:
Operation Schemes Operation Schemes
----------------- -----------------
@ -255,6 +257,8 @@ the access pattern of interest, and applies the user-desired operation actions
to the regions as soon as found. to the regions as soon as found.
.. _damon_design_damos_action:
Operation Action Operation Action
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
@ -277,6 +281,8 @@ characteristics. Hence, DAMOS resets the age of regions when an action is
applied to those. applied to those.
.. _damon_design_damos_access_pattern:
Target Access Pattern Target Access Pattern
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
@ -288,6 +294,8 @@ region's three properties are in the ranges, DAMOS classifies it as one of the
regions that the scheme is having an interest in. regions that the scheme is having an interest in.
.. _damon_design_damos_quotas:
Quotas Quotas
~~~~~~ ~~~~~~
@ -305,6 +313,8 @@ can use for applying the action, and/or a maximum bytes of memory regions that
the action can be applied within a user-specified time duration. the action can be applied within a user-specified time duration.
.. _damon_design_damos_quotas_prioritization:
Prioritization Prioritization
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
@ -330,6 +340,8 @@ the weight will be respected are up to the underlying prioritization mechanism
implementation. implementation.
.. _damon_design_damos_watermarks:
Watermarks Watermarks
~~~~~~~~~~ ~~~~~~~~~~
@ -350,6 +362,8 @@ is also deactivated. In this case, the DAMON worker thread only periodically
checks the watermarks and therefore incurs nearly zero overhead. checks the watermarks and therefore incurs nearly zero overhead.
.. _damon_design_damos_filters:
Filters Filters
~~~~~~~ ~~~~~~~