@@ -10,21 +10,16 @@ DAMON provides below interfaces for different users.
1010 `This <https://github.com/awslabs/damo >`_ is for privileged people such as
1111 system administrators who want a just-working human-friendly interface.
1212 Using this, users can use the DAMON’s major features in a human-friendly way.
13- It may not be highly tuned for special cases, though. It supports both
14- virtual and physical address spaces monitoring. For more detail, please
15- refer to its `usage document
13+ It may not be highly tuned for special cases, though. For more detail,
14+ please refer to its `usage document
1615 <https://github.com/awslabs/damo/blob/next/USAGE.md> `_.
1716- *sysfs interface. *
1817 :ref: `This <sysfs_interface >` is for privileged user space programmers who
1918 want more optimized use of DAMON. Using this, users can use DAMON’s major
2019 features by reading from and writing to special sysfs files. Therefore,
2120 you can write and use your personalized DAMON sysfs wrapper programs that
2221 reads/writes the sysfs files instead of you. The `DAMON user space tool
23- <https://github.com/awslabs/damo> `_ is one example of such programs. It
24- supports both virtual and physical address spaces monitoring. Note that this
25- interface provides only simple :ref: `statistics <damos_stats >` for the
26- monitoring results. For detailed monitoring results, DAMON provides a
27- :ref: `tracepoint <tracepoint >`.
22+ <https://github.com/awslabs/damo> `_ is one example of such programs.
2823- *debugfs interface. (DEPRECATED!) *
2924 :ref: `This <debugfs_interface >` is almost identical to :ref: `sysfs interface
3025 <sysfs_interface>`. This is deprecated, so users should move to the
@@ -139,7 +134,7 @@ scheme of the kdamond. Writing ``clear_schemes_tried_regions`` to ``state``
139134file clears the DAMON-based operating scheme action tried regions directory for
140135each DAMON-based operation scheme of the kdamond. For details of the
141136DAMON-based operation scheme action tried regions directory, please refer to
142- :ref: tried_regions section <sysfs_schemes_tried_regions>`.
137+ :ref: ` tried_regions section <sysfs_schemes_tried_regions >`.
143138
144139If the state is ``on ``, reading ``pid `` shows the pid of the kdamond thread.
145140
@@ -259,12 +254,9 @@ be equal or smaller than ``start`` of directory ``N+1``.
259254contexts/<N>/schemes/
260255---------------------
261256
262- For usual DAMON-based data access aware memory management optimizations, users
263- would normally want the system to apply a memory management action to a memory
264- region of a specific access pattern. DAMON receives such formalized operation
265- schemes from the user and applies those to the target memory regions. Users
266- can get and set the schemes by reading from and writing to files under this
267- directory.
257+ The directory for DAMON-based Operation Schemes (:ref: `DAMOS
258+ <damon_design_damos>`). Users can get and set the schemes by reading from and
259+ writing to files under this directory.
268260
269261In the beginning, this directory has only one file, ``nr_schemes ``. Writing a
270262number (``N ``) to the file creates the number of child directories named ``0 ``
@@ -277,12 +269,12 @@ In each scheme directory, five directories (``access_pattern``, ``quotas``,
277269``watermarks ``, ``filters ``, ``stats ``, and ``tried_regions ``) and one file
278270(``action ``) exist.
279271
280- The ``action `` file is for setting and getting what action you want to apply to
281- memory regions having specific access pattern of the interest. The keywords
282- that can be written to and read from the file and their meaning are as below.
272+ The ``action `` file is for setting and getting the scheme's :ref: ` action
273+ <damon_design_damos_action>`. The keywords that can be written to and read
274+ from the file and their meaning are as below.
283275
284276Note that support of each action depends on the running DAMON operations set
285- `implementation <sysfs_contexts> `.
277+ :ref: `implementation <sysfs_contexts >`.
286278
287279 - ``willneed ``: Call ``madvise() `` for the region with ``MADV_WILLNEED ``.
288280 Supported by ``vaddr `` and ``fvaddr `` operations set.
@@ -304,56 +296,48 @@ Note that support of each action depends on the running DAMON operations set
304296schemes/<N>/access_pattern/
305297---------------------------
306298
307- The target access pattern of each DAMON-based operation scheme is constructed
308- with three ranges including the size of the region in bytes, number of
309- monitored accesses per aggregate interval, and number of aggregated intervals
310- for the age of the region.
299+ The directory for the target access :ref: `pattern
300+ <damon_design_damos_access_pattern>` of the given DAMON-based operation scheme.
311301
312302Under the ``access_pattern `` directory, three directories (``sz ``,
313303``nr_accesses ``, and ``age ``) each having two files (``min `` and ``max ``)
314304exist. You can set and get the access pattern for the given scheme by writing
315305to and reading from the ``min `` and ``max `` files under ``sz ``,
316- ``nr_accesses ``, and ``age `` directories, respectively.
306+ ``nr_accesses ``, and ``age `` directories, respectively. Note that the ``min ``
307+ and the ``max `` form a closed interval.
317308
318309schemes/<N>/quotas/
319310-------------------
320311
321- Optimal ``target access pattern `` for each ``action `` is workload dependent, so
322- not easy to find. Worse yet, setting a scheme of some action too aggressive
323- can cause severe overhead. To avoid such overhead, users can limit time and
324- size quota for each scheme. In detail, users can ask DAMON to try to use only
325- up to specific time (``time quota ``) for applying the action, and to apply the
326- action to only up to specific amount (``size quota ``) of memory regions having
327- the target access pattern within a given time interval (``reset interval ``).
328-
329- When the quota limit is expected to be exceeded, DAMON prioritizes found memory
330- regions of the ``target access pattern `` based on their size, access frequency,
331- and age. For personalized prioritization, users can set the weights for the
332- three properties.
312+ The directory for the :ref: `quotas <damon_design_damos_quotas >` of the given
313+ DAMON-based operation scheme.
333314
334315Under ``quotas `` directory, three files (``ms ``, ``bytes ``,
335316``reset_interval_ms ``) and one directory (``weights ``) having three files
336317(``sz_permil ``, ``nr_accesses_permil ``, and ``age_permil ``) in it exist.
337318
338319You can set the ``time quota `` in milliseconds, ``size quota `` in bytes, and
339320``reset interval `` in milliseconds by writing the values to the three files,
340- respectively. You can also set the prioritization weights for size, access
341- frequency, and age in per-thousand unit by writing the values to the three
342- files under the ``weights `` directory.
321+ respectively. Then, DAMON tries to use only up to ``time quota `` milliseconds
322+ for applying the ``action `` to memory regions of the ``access_pattern ``, and to
323+ apply the action to only up to ``bytes `` bytes of memory regions within the
324+ ``reset_interval_ms ``. Setting both ``ms `` and ``bytes `` zero disables the
325+ quota limits.
326+
327+ You can also set the :ref: `prioritization weights
328+ <damon_design_damos_quotas_prioritization>` for size, access frequency, and age
329+ in per-thousand unit by writing the values to the three files under the
330+ ``weights `` directory.
343331
344332schemes/<N>/watermarks/
345333-----------------------
346334
347- To allow easy activation and deactivation of each scheme based on system
348- status, DAMON provides a feature called watermarks. The feature receives five
349- values called ``metric ``, ``interval ``, ``high ``, ``mid ``, and ``low ``. The
350- ``metric `` is the system metric such as free memory ratio that can be measured.
351- If the metric value of the system is higher than the value in ``high `` or lower
352- than ``low `` at the memoent, the scheme is deactivated. If the value is lower
353- than ``mid ``, the scheme is activated.
335+ The directory for the :ref: `watermarks <damon_design_damos_watermarks >` of the
336+ given DAMON-based operation scheme.
354337
355338Under the watermarks directory, five files (``metric ``, ``interval_us ``,
356- ``high ``, ``mid ``, and ``low ``) for setting each value exist. You can set and
339+ ``high ``, ``mid ``, and ``low ``) for setting the metric, the time interval
340+ between check of the metric, and the three watermarks exist. You can set and
357341get the five values by writing to the files, respectively.
358342
359343Keywords and meanings of those that can be written to the ``metric `` file are
@@ -367,12 +351,8 @@ The ``interval`` should written in microseconds unit.
367351schemes/<N>/filters/
368352--------------------
369353
370- Users could know something more than the kernel for specific types of memory.
371- In the case, users could do their own management for the memory and hence
372- doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access
373- pattern of the scheme and/or the monitoring regions for the purpose, but that
374- can be inefficient in some cases. In such cases, users could set non-access
375- pattern driven filters using files in this directory.
354+ The directory for the :ref: `filters <damon_design_damos_filters >` of the given
355+ DAMON-based operation scheme.
376356
377357In the beginning, this directory has only one file, ``nr_filters ``. Writing a
378358number (``N ``) to the file creates the number of child directories named ``0 ``
@@ -432,13 +412,17 @@ starting from ``0`` under this directory. Each directory contains files
432412exposing detailed information about each of the memory region that the
433413corresponding scheme's ``action `` has tried to be applied under this directory,
434414during next :ref: `aggregation interval <sysfs_monitoring_attrs >`. The
435- information includes address range, ``nr_accesses ``, , and ``age `` of the
436- region.
415+ information includes address range, ``nr_accesses ``, and ``age `` of the region.
437416
438417The directories will be removed when another special keyword,
439418``clear_schemes_tried_regions ``, is written to the relevant
440419``kdamonds/<N>/state `` file.
441420
421+ The expected usage of this directory is investigations of schemes' behaviors,
422+ and query-like efficient data access monitoring results retrievals. For the
423+ latter use case, in particular, users can set the ``action `` as ``stat `` and
424+ set the ``access pattern `` as their interested pattern that they want to query.
425+
442426tried_regions/<N>/
443427------------------
444428
@@ -600,15 +584,10 @@ update.
600584Schemes
601585-------
602586
603- For usual DAMON-based data access aware memory management optimizations, users
604- would simply want the system to apply a memory management action to a memory
605- region of a specific access pattern. DAMON receives such formalized operation
606- schemes from the user and applies those to the target processes.
607-
608- Users can get and set the schemes by reading from and writing to ``schemes ``
609- debugfs file. Reading the file also shows the statistics of each scheme. To
610- the file, each of the schemes should be represented in each line in below
611- form::
587+ Users can get and set the DAMON-based operation :ref: `schemes
588+ <damon_design_damos>` by reading from and writing to ``schemes `` debugfs file.
589+ Reading the file also shows the statistics of each scheme. To the file, each
590+ of the schemes should be represented in each line in below form::
612591
613592 <target access pattern> <action> <quota> <watermarks>
614593
@@ -617,8 +596,9 @@ You can disable schemes by simply writing an empty string to the file.
617596Target Access Pattern
618597~~~~~~~~~~~~~~~~~~~~~
619598
620- The ``<target access pattern> `` is constructed with three ranges in below
621- form::
599+ The target access :ref: `pattern <damon_design_damos_access_pattern >` of the
600+ scheme. The ``<target access pattern> `` is constructed with three ranges in
601+ below form::
622602
623603 min-size max-size min-acc max-acc min-age max-age
624604
@@ -631,9 +611,9 @@ closed interval.
631611Action
632612~~~~~~
633613
634- The ``<action> `` is a predefined integer for memory management actions, which
635- DAMON will apply to the regions having the target access pattern. The
636- supported numbers and their meanings are as below.
614+ The ``<action> `` is a predefined integer for memory management :ref: ` actions
615+ <damon_design_damos_action>`. The supported numbers and their meanings are as
616+ below.
637617
638618 - 0: Call ``madvise() `` for the region with ``MADV_WILLNEED ``. Ignored if
639619 ``target `` is ``paddr ``.
@@ -649,10 +629,8 @@ supported numbers and their meanings are as below.
649629Quota
650630~~~~~
651631
652- Optimal ``target access pattern `` for each ``action `` is workload dependent, so
653- not easy to find. Worse yet, setting a scheme of some action too aggressive
654- can cause severe overhead. To avoid such overhead, users can limit time and
655- size quota for the scheme via the ``<quota> `` in below form::
632+ Users can set the :ref: `quotas <damon_design_damos_quotas >` of the given scheme
633+ via the ``<quota> `` in below form::
656634
657635 <ms> <sz> <reset interval> <priority weights>
658636
@@ -662,19 +640,17 @@ the action to memory regions of the ``target access pattern`` within the
662640``<sz> `` bytes of memory regions within the ``<reset interval> ``. Setting both
663641``<ms> `` and ``<sz> `` zero disables the quota limits.
664642
665- When the quota limit is expected to be exceeded, DAMON prioritizes found memory
666- regions of the ``target access pattern `` based on their size, access frequency,
667- and age. For personalized prioritization, users can set the weights for the
668- three properties in ``<priority weights> `` in below form::
643+ For the :ref: `prioritization <damon_design_damos_quotas_prioritization >`, users
644+ can set the weights for the three properties in ``<priority weights> `` in below
645+ form::
669646
670647 <size weight> <access frequency weight> <age weight>
671648
672649Watermarks
673650~~~~~~~~~~
674651
675- Some schemes would need to run based on current value of the system's specific
676- metrics like free memory ratio. For such cases, users can specify watermarks
677- for the condition.::
652+ Users can specify :ref: `watermarks <damon_design_damos_watermarks >` of the
653+ given scheme via ``<watermarks> `` in below form::
678654
679655 <metric> <check interval> <high mark> <middle mark> <low mark>
680656
@@ -797,10 +773,12 @@ root directory only.
797773Tracepoint for Monitoring Results
798774=================================
799775
800- DAMON provides the monitoring results via a tracepoint,
801- ``damon:damon_aggregated ``. While the monitoring is turned on, you could
802- record the tracepoint events and show results using tracepoint supporting tools
803- like ``perf ``. For example::
776+ Users can get the monitoring results via the :ref: `tried_regions
777+ <sysfs_schemes_tried_regions>` or a tracepoint, ``damon:damon_aggregated ``.
778+ While the tried regions directory is useful for getting a snapshot, the
779+ tracepoint is useful for getting a full record of the results. While the
780+ monitoring is turned on, you could record the tracepoint events and show
781+ results using tracepoint supporting tools like ``perf ``. For example::
804782
805783 # echo on > monitor_on
806784 # perf record -e damon:damon_aggregated &
0 commit comments