[RFC v4 8/8] Docs/damon: Document physical memory monitoring support

From: SeongJae Park
Date: Tue Jun 16 2020 - 10:13:10 EST


From: SeongJae Park <sjpark@xxxxxxxxx>

This commit adds description for the physical memory monitoring usage in
the DAMON document.

Signed-off-by: SeongJae Park <sjpark@xxxxxxxxx>
---
Documentation/admin-guide/mm/damon/faq.rst | 7 +--
Documentation/admin-guide/mm/damon/index.rst | 1 -
Documentation/admin-guide/mm/damon/plans.rst | 7 ---
Documentation/admin-guide/mm/damon/usage.rst | 59 ++++++++++++++------
4 files changed, 46 insertions(+), 28 deletions(-)
delete mode 100644 Documentation/admin-guide/mm/damon/plans.rst

diff --git a/Documentation/admin-guide/mm/damon/faq.rst b/Documentation/admin-guide/mm/damon/faq.rst
index b1f108009115..d72d6182d7ea 100644
--- a/Documentation/admin-guide/mm/damon/faq.rst
+++ b/Documentation/admin-guide/mm/damon/faq.rst
@@ -45,10 +45,9 @@ constructions and actual access checks can be implemented and configured on the
DAMON core by the users. In this way, DAMON users can monitor any address
space with any access check technique.

-Nonetheless, DAMON provides a vma tracking and PTE Accessed bit check based
-implementation of the address space dependent functions for the virtual memory
-by default, for a reference and convenient use. In near future, we will also
-provide that for physical memory address space.
+Nonetheless, DAMON provides vma/rmap tracking and PTE Accessed bit check based
+implementations of the address space dependent functions for the virtual memory
+and the physical memory by default, for a reference and convenient use.


Can I simply monitor page granularity?
diff --git a/Documentation/admin-guide/mm/damon/index.rst b/Documentation/admin-guide/mm/damon/index.rst
index 4d128e4fd9c8..7b2939d50408 100644
--- a/Documentation/admin-guide/mm/damon/index.rst
+++ b/Documentation/admin-guide/mm/damon/index.rst
@@ -33,4 +33,3 @@ optimizations of their systems.
faq
mechanisms
eval
- plans
diff --git a/Documentation/admin-guide/mm/damon/plans.rst b/Documentation/admin-guide/mm/damon/plans.rst
deleted file mode 100644
index 765344f02eb3..000000000000
--- a/Documentation/admin-guide/mm/damon/plans.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-============
-Future Plans
-============
-
-TBD.
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index 24f1b05a859a..b2bcbd6ebe9d 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -61,9 +61,11 @@ Recording Data Access Pattern
-----------------------------

The ``record`` subcommand records the data access pattern of target processes
-in a file (``./damon.data`` by default). You can specify the target as either
-pid of running target or a command for execution of the process. Below example
-shows a command target usage::
+in a file (``./damon.data`` by default). You can specify the target with 1)
+the command for execution of the monitoring target process, 2) pid of running
+target process, or 3) the special keyword, 'paddr', if you want to monitor the
+system's physical memory address space. Below example shows a command target
+usage::

# cd <kernel>/tools/damon/
# damo record "sleep 5"
@@ -74,6 +76,15 @@ of the process. Below example shows a pid target usage::
# sleep 5 &
# damo record `pidof sleep`

+Finally, below example shows the use of the special keyword, 'paddr'::
+
+ # damo record paddr
+
+In this case, the monitoring target regions defaults to the largetst 'System
+RAM' region specified in '/proc/iomem' file. Note that the initial monitoring
+target region is maintained rather than dynamically updated like the virtual
+memory address spaces monitoring mode.
+
You can tune this by setting the monitoring attributes and path to the record
file using optional arguments to the subcommand. To know about the monitoring
attributes in detail, please refer to :doc:`mechanisms`.
@@ -317,27 +328,42 @@ check it again::
Target PIDs
-----------

-Users can get and set the pids of monitoring target processes by reading from
-and writing to the ``pids`` file. For example, below commands set processes
-having pids 42 and 4242 as the processes to be monitored and check it again::
+To monitor the virtual memory address spaces of specific processes, users can
+get and set the pids of monitoring target processes by reading from and writing
+to the ``pids`` file. For example, below commands set processes having pids 42
+and 4242 as the processes to be monitored and check it again::

# cd <debugfs>/damon
# echo 42 4242 > pids
# cat pids
42 4242

+Users can also monitor the physical memory address space of the system by
+writing a special keyword, "``paddr\n``" to the file. In this case, reading the
+file will show ``-1``, as below::
+
+ # cd <debugfs>/damon
+ # echo paddr > pids
+ # cat pids
+ -1
+
Note that setting the pids doesn't start the monitoring.


Initial Monitoring Target Regions
---------------------------------

-DAMON automatically sets and updates the monitoring target regions so that
-entire memory mappings of target processes can be covered. However, users
-might want to limit the monitoring region to specific address ranges, such as
-the heap, the stack, or specific file-mapped area. Or, some users might know
-the initial access pattern of their workloads and therefore want to set optimal
-initial regions for the 'adaptive regions adjustment'.
+In case of the virtual memory monitoring, DAMON automatically sets and updates
+the monitoring target regions so that entire memory mappings of target
+processes can be covered. However, users might want to limit the monitoring
+region to specific address ranges, such as the heap, the stack, or specific
+file-mapped area. Or, some users might know the initial access pattern of
+their workloads and therefore want to set optimal initial regions for the
+'adaptive regions adjustment'.
+
+In contrast, DAMON do not automatically sets and updates the monitoring target
+regions in case of physical memory monitoring. Therefore, users should set the
+monitoring target regions by themselves.

In such cases, users can explicitly set the initial monitoring target regions
as they want, by writing proper values to the ``init_regions`` file. Each line
@@ -357,10 +383,11 @@ region of process 42, and another couple of address ranges, ``20-40`` and
4242 20 40
4242 50 100" > init_regions

-Note that this sets the initial monitoring target regions only. DAMON will
-automatically updates the boundary of the regions after one ``regions update
-interval``. Therefore, users should set the ``regions update interval`` large
-enough.
+Note that this sets the initial monitoring target regions only. In case of
+virtual memory monitoring, DAMON will automatically updates the boundary of the
+regions after one ``regions update interval``. Therefore, users should set the
+``regions update interval`` large enough in this case, if they don't want the
+update.


Record
--
2.17.1