lkml.org 
[lkml]   [2020]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v13 09/15] mm/damon: Add debugfs interface
Date
On 2020-05-25T11:15:06+02:00 SeongJae Park <sjpark@amazon.com> wrote:

> From: SeongJae Park <sjpark@amazon.de>
>
> This commit adds a debugfs interface for DAMON.
>
> DAMON exports four files, ``attrs``, ``pids``, ``record``, and
> ``monitor_on`` under its debugfs directory, ``<debugfs>/damon/``.
>
> Attributes
> ----------
>
> Users can read and write the ``sampling interval``, ``aggregation
> interval``, ``regions update interval``, and min/max number of
> monitoring target regions by reading from and writing to the ``attrs``
> file. For example, below commands set those values to 5 ms, 100 ms,
> 1,000 ms, 10, 1000 and check it again::
>
> # cd <debugfs>/damon
> # echo 5000 100000 1000000 10 1000 > attrs
> # cat attrs
> 5000 100000 1000000 10 1000
>
> Target PIDs
> -----------
>
> Users can read and write the pids of current 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
>
> Note that setting the pids doesn't start the monitoring.
>
> Record
> ------
>
> DAMON supports direct monitoring result record feature. The recorded
> results are first written to a buffer and flushed to a file in batch.
> Users can set the size of the buffer and the path to the result file by
> reading from and writing to the ``record`` file. For example, below
> commands set the buffer to be 4 KiB and the result to be saved in
> '/damon.data'.
>
> # cd <debugfs>/damon
> # echo 4096 /damon.data > pids
> # cat record
> 4096 /damon.data
>
> Turning On/Off
> --------------
>
> You can check current status, start and stop the monitoring by reading
> from and writing to the ``monitor_on`` file. Writing ``on`` to the file
> starts DAMON to monitor the target processes with the attributes.
> Writing ``off`` to the file stops DAMON. DAMON also stops if every
> target processes is terminated. Below example commands turn on, off,
> and check status of DAMON::
>
> # cd <debugfs>/damon
> # echo on > monitor_on
> # echo off > monitor_on
> # cat monitor_on
> off
>
> Please note that you cannot write to the ``attrs`` and ``pids`` files
> while the monitoring is turned on. If you write to the files while
> DAMON is running, ``-EINVAL`` will be returned.
>
> Signed-off-by: SeongJae Park <sjpark@amazon.de>
> ---

Reviewed-by: Leonard Foerster <foersleo@amazon.de>

\
 
 \ /
  Last update: 2020-05-27 13:24    [W:0.141 / U:3.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site