sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget./translations/zh_CN/admin-guide/mm/damon/usagemodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/zh_TW/admin-guide/mm/damon/usagemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/it_IT/admin-guide/mm/damon/usagemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ja_JP/admin-guide/mm/damon/usagemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ko_KR/admin-guide/mm/damon/usagemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/sp_SP/admin-guide/mm/damon/usagemodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhH/var/lib/git/docbuild/linux/Documentation/admin-guide/mm/damon/usage.rsthKubhsection)}(hhh](htitle)}(hDetailed Usagesh]hDetailed Usages}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h4DAMON provides below interfaces for different users.h]h4DAMON provides below interfaces for different users.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh bullet_list)}(hhh](h list_item)}(hX*DAMON user space tool.* `This `_ is for privileged people such as system administrators who want a just-working human-friendly interface. Using this, users can use the DAMON’s major features in a human-friendly way. It may not be highly tuned for special cases, though. For more detail, please refer to its `usage document `_.h]h)}(hX*DAMON user space tool.* `This `_ is for privileged people such as system administrators who want a just-working human-friendly interface. Using this, users can use the DAMON’s major features in a human-friendly way. It may not be highly tuned for special cases, though. For more detail, please refer to its `usage document `_.h](hemphasis)}(h*DAMON user space tool.*h]hDAMON user space tool.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh }(hhhhhNhNubh reference)}(h+`This `_h]hThis}(hhhhhNhNubah}(h]h ]h"]h$]h&]nameThisrefuri!https://github.com/damonitor/damouh1hhhubhtarget)}(h$ h]h}(h]thisah ]h"]thisah$]h&]refurijuh1j referencedKhhubhX is for privileged people such as system administrators who want a just-working human-friendly interface. Using this, users can use the DAMON’s major features in a human-friendly way. It may not be highly tuned for special cases, though. For more detail, please refer to its }(hhhhhNhNubh)}(hH`usage document `_h]husage document}(hj$hhhNhNubah}(h]h ]h"]h$]h&]nameusage documentj4https://github.com/damonitor/damo/blob/next/USAGE.mduh1hhhubj)}(h7 h]h}(h]usage-documentah ]h"]usage documentah$]h&]refurij4uh1jjKhhubh.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubh)}(hX*sysfs interface.* :ref:`This ` is for privileged user space programmers who want more optimized use of DAMON. Using this, users can use DAMON’s major features by reading from and writing to special sysfs files. Therefore, you can write and use your personalized DAMON sysfs wrapper programs that reads/writes the sysfs files instead of you. The `DAMON user space tool `_ is one example of such programs.h]h)}(hX*sysfs interface.* :ref:`This ` is for privileged user space programmers who want more optimized use of DAMON. Using this, users can use DAMON’s major features by reading from and writing to special sysfs files. Therefore, you can write and use your personalized DAMON sysfs wrapper programs that reads/writes the sysfs files instead of you. The `DAMON user space tool `_ is one example of such programs.h](h)}(h*sysfs interface.*h]hsysfs interface.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjVubh }(hjVhhhNhNubh)}(h:ref:`This `h]hinline)}(hjnh]hThis}(hjrhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jphjlubah}(h]h ]h"]h$]h&]refdocadmin-guide/mm/damon/usage refdomainj}reftyperef refexplicitrefwarn reftargetsysfs_interfaceuh1hhhhKhjVubhX@ is for privileged user space programmers who want more optimized use of DAMON. Using this, users can use DAMON’s major features by reading from and writing to special sysfs files. Therefore, you can write and use your personalized DAMON sysfs wrapper programs that reads/writes the sysfs files instead of you. The }(hjVhhhNhNubh)}(h<`DAMON user space tool `_h]hDAMON user space tool}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameDAMON user space toolj!https://github.com/damonitor/damouh1hhjVubj)}(h$ h]h}(h]damon-user-space-toolah ]h"]damon user space toolah$]h&]refurijuh1jjKhjVubh! is one example of such programs.}(hjVhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjRubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubh)}(hXv*Kernel Space Programming Interface.* :doc:`This ` is for kernel space programmers. Using this, users can utilize every feature of DAMON most flexibly and efficiently by writing kernel space DAMON application programs for you. You can even extend DAMON for various address spaces. For detail, please refer to the interface :doc:`document `. h]h)}(hXu*Kernel Space Programming Interface.* :doc:`This ` is for kernel space programmers. Using this, users can utilize every feature of DAMON most flexibly and efficiently by writing kernel space DAMON application programs for you. You can even extend DAMON for various address spaces. For detail, please refer to the interface :doc:`document `.h](h)}(h%*Kernel Space Programming Interface.*h]h#Kernel Space Programming Interface.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh }(hjhhhNhNubh)}(h:doc:`This `h]jq)}(hjh]hThis}(hjhhhNhNubah}(h]h ](j|stdstd-doceh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypedoc refexplicitrefwarnj /mm/damon/apiuh1hhhhKhjubhX is for kernel space programmers. Using this, users can utilize every feature of DAMON most flexibly and efficiently by writing kernel space DAMON application programs for you. You can even extend DAMON for various address spaces. For detail, please refer to the interface }(hjhhhNhNubh)}(h:doc:`document `h]jq)}(hjh]hdocument}(hjhhhNhNubah}(h]h ](j|stdstd-doceh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypedoc refexplicitrefwarnj /mm/damon/apiuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1hhhhK hhhhubj)}(h.. _sysfs_interface:h]h}(h]h ]h"]h$]h&]refidsysfs-interfaceuh1jhKhhhhhhubh)}(hhh](h)}(hsysfs Interfaceh]hsysfs Interface}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjEhhhhhK!ubh)}(hDAMON sysfs interface is built when ``CONFIG_DAMON_SYSFS`` is defined. It creates multiple directories and files under its sysfs directory, ``/kernel/mm/damon/``. You can control DAMON by writing to and reading from the files under the directory.h](h$DAMON sysfs interface is built when }(hjVhhhNhNubhliteral)}(h``CONFIG_DAMON_SYSFS``h]hCONFIG_DAMON_SYSFS}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjVubhS is defined. It creates multiple directories and files under its sysfs directory, }(hjVhhhNhNubj_)}(h``/kernel/mm/damon/``h]h/kernel/mm/damon/}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjVubhV. You can control DAMON by writing to and reading from the files under the directory.}(hjVhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK#hjEhhubh)}(haFor a short example, users can monitor the virtual address space of a given workload as below. ::h]h^For a short example, users can monitor the virtual address space of a given workload as below.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjEhhubh literal_block)}(hX5# cd /sys/kernel/mm/damon/admin/ # echo 1 > kdamonds/nr_kdamonds && echo 1 > kdamonds/0/contexts/nr_contexts # echo vaddr > kdamonds/0/contexts/0/operations # echo 1 > kdamonds/0/contexts/0/targets/nr_targets # echo $(pidof ) > kdamonds/0/contexts/0/targets/0/pid_target # echo on > kdamonds/0/stateh]hX5# cd /sys/kernel/mm/damon/admin/ # echo 1 > kdamonds/nr_kdamonds && echo 1 > kdamonds/0/contexts/nr_contexts # echo vaddr > kdamonds/0/contexts/0/operations # echo 1 > kdamonds/0/contexts/0/targets/nr_targets # echo $(pidof ) > kdamonds/0/contexts/0/targets/0/pid_target # echo on > kdamonds/0/state}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK+hjEhhubh)}(hhh](h)}(hFiles Hierarchyh]hFiles Hierarchy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK3ubh)}(hThe files hierarchy of DAMON sysfs interface is shown below. In the below figure, parents-children relations are represented with indentations, each directory is having ``/`` suffix, and files in each directory are separated by comma (",").h](hThe files hierarchy of DAMON sysfs interface is shown below. In the below figure, parents-children relations are represented with indentations, each directory is having }(hjhhhNhNubj_)}(h``/``h]h/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhF suffix, and files in each directory are separated by comma (“,”).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK5hjhhubj)}(hX:ref:`/sys/kernel/mm/damon `/admin │ :ref:`kdamonds `/nr_kdamonds │ │ :ref:`0 `/state,pid │ │ │ :ref:`contexts `/nr_contexts │ │ │ │ :ref:`0 `/avail_operations,operations │ │ │ │ │ :ref:`monitoring_attrs `/ │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us │ │ │ │ │ │ │ intervals_goal/access_bp,aggrs,min_sample_us,max_sample_us │ │ │ │ │ │ nr_regions/min,max │ │ │ │ │ :ref:`targets `/nr_targets │ │ │ │ │ │ :ref:`0 `/pid_target │ │ │ │ │ │ │ :ref:`regions `/nr_regions │ │ │ │ │ │ │ │ :ref:`0 `/start,end │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ │ :ref:`schemes `/nr_schemes │ │ │ │ │ │ :ref:`0 `/action,target_nid,apply_interval_us │ │ │ │ │ │ │ :ref:`access_pattern `/ │ │ │ │ │ │ │ │ sz/min,max │ │ │ │ │ │ │ │ nr_accesses/min,max │ │ │ │ │ │ │ │ age/min,max │ │ │ │ │ │ │ :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil │ │ │ │ │ │ │ │ :ref:`goals `/nr_goals │ │ │ │ │ │ │ │ │ 0/target_metric,target_value,current_value │ │ │ │ │ │ │ :ref:`watermarks `/metric,interval_us,high,mid,low │ │ │ │ │ │ │ :ref:`{core_,ops_,}filters `/nr_filters │ │ │ │ │ │ │ │ 0/type,matching,allow,memcg_path,addr_start,addr_end,target_idx,min,max │ │ │ │ │ │ │ :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds │ │ │ │ │ │ │ :ref:`tried_regions `/total_bytes │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ ... │ │ ...h](h)}(h(:ref:`/sys/kernel/mm/damon `h]jq)}(hjh]h/sys/kernel/mm/damon}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sysfs_rootuh1hhhhK:hjubh /admin │ }hjsbh)}(h :ref:`kdamonds `h]jq)}(hjh]hkdamonds}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_kdamondsuh1hhhhK:hjubh/nr_kdamonds │ │ }hjsbh)}(h:ref:`0 `h]jq)}(hj'h]h0}(hj)hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj%ubah}(h]h ]h"]h$]h&]refdocj refdomainj3reftyperef refexplicitrefwarnj sysfs_kdamonduh1hhhhK:hjubh/state,pid │ │ │ }hjsbh)}(h :ref:`contexts `h]jq)}(hjKh]hcontexts}(hjMhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjIubah}(h]h ]h"]h$]h&]refdocj refdomainjWreftyperef refexplicitrefwarnjsysfs_contextsuh1hhhhK:hjubh/nr_contexts │ │ │ │ }hjsbh)}(h:ref:`0 `h]jq)}(hjoh]h0}(hjqhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjmubah}(h]h ]h"]h$]h&]refdocj refdomainj{reftyperef refexplicitrefwarnj sysfs_contextuh1hhhhK:hjubh1/avail_operations,operations │ │ │ │ │ }hjsbh)}(h0:ref:`monitoring_attrs `h]jq)}(hjh]hmonitoring_attrs}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_monitoring_attrsuh1hhhhK:hjubh/ │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us │ │ │ │ │ │ │ intervals_goal/access_bp,aggrs,min_sample_us,max_sample_us │ │ │ │ │ │ nr_regions/min,max │ │ │ │ │ }hjsbh)}(h:ref:`targets `h]jq)}(hjh]htargets}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sysfs_targetsuh1hhhhK:hjubh$/nr_targets │ │ │ │ │ │ }hjsbh)}(h:ref:`0 `h]jq)}(hjh]h0}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sysfs_targetuh1hhhhK:hjubh(/pid_target │ │ │ │ │ │ │ }hjsbh)}(h:ref:`regions `h]jq)}(hjh]hregions}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj sysfs_regionsuh1hhhhK:hjubh,/nr_regions │ │ │ │ │ │ │ │ }hjsbh)}(h:ref:`0 `h]jq)}(hj#h]h0}(hj%hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj!ubah}(h]h ]h"]h$]h&]refdocj refdomainj/reftyperef refexplicitrefwarnj sysfs_regionuh1hhhhK:hjubh_/start,end │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ │ }hjsbh)}(h:ref:`schemes `h]jq)}(hjGh]hschemes}(hjIhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjEubah}(h]h ]h"]h$]h&]refdocj refdomainjSreftyperef refexplicitrefwarnj sysfs_schemesuh1hhhhK:hjubh$/nr_schemes │ │ │ │ │ │ }hjsbh)}(h:ref:`0 `h]jq)}(hjkh]h0}(hjmhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjiubah}(h]h ]h"]h$]h&]refdocj refdomainjwreftyperef refexplicitrefwarnj sysfs_schemeuh1hhhhK:hjubhA/action,target_nid,apply_interval_us │ │ │ │ │ │ │ }hjsbh)}(h,:ref:`access_pattern `h]jq)}(hjh]haccess_pattern}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_access_patternuh1hhhhK:hjubh/ │ │ │ │ │ │ │ │ sz/min,max │ │ │ │ │ │ │ │ nr_accesses/min,max │ │ │ │ │ │ │ │ age/min,max │ │ │ │ │ │ │ }hjsbh)}(h:ref:`quotas `h]jq)}(hjh]hquotas}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sysfs_quotasuh1hhhhK:hjubh/ms,bytes,reset_interval_ms,effective_bytes │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil │ │ │ │ │ │ │ │ }hjsbh)}(h(:ref:`goals `h]jq)}(hjh]hgoals}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_schemes_quota_goalsuh1hhhhK:hjubhu/nr_goals │ │ │ │ │ │ │ │ │ 0/target_metric,target_value,current_value │ │ │ │ │ │ │ }hjsbh)}(h$:ref:`watermarks `h]jq)}(hjh]h watermarks}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_watermarksuh1hhhhK:hjubh=/metric,interval_us,high,mid,low │ │ │ │ │ │ │ }hjsbh)}(h+:ref:`{core_,ops_,}filters `h]jq)}(hjh]h{core_,ops_,}filters}(hj!hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj+reftyperef refexplicitrefwarnj sysfs_filtersuh1hhhhK:hjubh/nr_filters │ │ │ │ │ │ │ │ 0/type,matching,allow,memcg_path,addr_start,addr_end,target_idx,min,max │ │ │ │ │ │ │ }hjsbh)}(h":ref:`stats `h]jq)}(hjCh]hstats}(hjEhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjAubah}(h]h ]h"]h$]h&]refdocj refdomainjOreftyperef refexplicitrefwarnjsysfs_schemes_statsuh1hhhhK:hjubhe/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds │ │ │ │ │ │ │ }hjsbh)}(h2:ref:`tried_regions `h]jq)}(hjgh]h tried_regions}(hjihhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjeubah}(h]h ]h"]h$]h&]refdocj refdomainjsreftyperef refexplicitrefwarnjsysfs_schemes_tried_regionsuh1hhhhK:hjubh/total_bytes │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ ... │ │ ...}hjsbeh}(h]h ]h"]h$]h&]hhuh1jhK/kernel/mm/damon/``, and it has one directory named ``admin``. The directory contains the files for privileged user space programs' control of DAMON. User space tools or daemons having the root permission could use this directory.h](h)The root of the DAMON sysfs interface is }(hjhhhNhNubj_)}(h``/kernel/mm/damon/``h]h/kernel/mm/damon/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh!, and it has one directory named }(hjhhhNhNubj_)}(h ``admin``h]hadmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. The directory contains the files for privileged user space programs’ control of DAMON. User space tools or daemons having the root permission could use this directory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKehjhhubj)}(h.. _sysfs_kdamonds:h]h}(h]h ]h"]h$]h&]jCsysfs-kdamondsuh1jhKjhjhhhhubeh}(h](rootjeh ]h"](root sysfs_rooteh$]h&]uh1hhjEhhhhhKcexpect_referenced_by_name}jjsexpect_referenced_by_id}jjsubh)}(hhh](h)}(h kdamonds/h]h kdamonds/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKmubh)}(hXUnder the ``admin`` directory, one directory, ``kdamonds``, which has files for controlling the kdamonds (refer to :ref:`design ` for more details) exists. In the beginning, this directory has only one file, ``nr_kdamonds``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each kdamond.h](h Under the }(hjhhhNhNubj_)}(h ``admin``h]hadmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory, one directory, }(hjhhhNhNubj_)}(h ``kdamonds``h]hkdamonds}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh9, which has files for controlling the kdamonds (refer to }(hjhhhNhNubh)}(h@:ref:`design `h]jq)}(hj<h]hdesign}(hj>hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj:ubah}(h]h ]h"]h$]h&]refdocj refdomainjHreftyperef refexplicitrefwarnj0damon_design_execution_model_and_data_structuresuh1hhhhKohjubhP for more details) exists. In the beginning, this directory has only one file, }(hjhhhNhNubj_)}(h``nr_kdamonds``h]h nr_kdamonds}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. Writing a number (}(hjhhhNhNubj_)}(h``N``h]hN}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh<) to the file creates the number of child directories named }(hjhhhNhNubj_)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh*. Each directory represents each kdamond.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKohjhhubj)}(h.. _sysfs_kdamond:h]h}(h]h ]h"]h$]h&]jC sysfs-kdamonduh1jhKwhjhhhhubeh}(h](kdamondsjeh ]h"]( kdamonds/sysfs_kdamondseh$]h&]uh1hhjEhhhhhKmj}jjsj}jjsubh)}(hhh](h)}(h kdamonds//h]h kdamonds//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKzubh)}(hdIn each kdamond directory, two files (``state`` and ``pid``) and one directory (``contexts``) exist.h](h&In each kdamond directory, two files (}(hjhhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``pid``h]hpid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and one directory (}(hjhhhNhNubj_)}(h ``contexts``h]hcontexts}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK|hjhhubh)}(hfReading ``state`` returns ``on`` if the kdamond is currently running, or ``off`` if it is not running.h](hReading }(hjhhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh returns }(hjhhhNhNubj_)}(h``on``h]hon}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) if the kdamond is currently running, or }(hjhhhNhNubj_)}(h``off``h]hoff}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh if it is not running.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hEUsers can write below commands for the kdamond to the ``state`` file.h](h6Users can write below commands for the kdamond to the }(hj[hhhNhNubj_)}(h ``state``h]hstate}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj[ubh file.}(hj[hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(h``on``: Start running.h]h)}(hjh](j_)}(h``on``h]hon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh: Start running.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj~ubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(h``off``: Stop running.h]h)}(hjh](j_)}(h``off``h]hoff}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh: Stop running.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(hP``commit``: Read the user inputs in the sysfs files except ``state`` file again.h]h)}(hP``commit``: Read the user inputs in the sysfs files except ``state`` file again.h](j_)}(h ``commit``h]hcommit}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh1: Read the user inputs in the sysfs files except }(hjhhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file again.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(hX3``update_tuned_intervals``: Update the contents of ``sample_us`` and ``aggr_us`` files of the kdamond with the auto-tuning applied ``sampling interval`` and ``aggregation interval`` for the files. Please refer to :ref:`intervals_goal section ` for more details.h]h)}(hX3``update_tuned_intervals``: Update the contents of ``sample_us`` and ``aggr_us`` files of the kdamond with the auto-tuning applied ``sampling interval`` and ``aggregation interval`` for the files. Please refer to :ref:`intervals_goal section ` for more details.h](j_)}(h``update_tuned_intervals``h]hupdate_tuned_intervals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh: Update the contents of }(hjhhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh3 files of the kdamond with the auto-tuning applied }(hjhhhNhNubj_)}(h``sampling interval``h]hsampling interval}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``aggregation interval``h]haggregation interval}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh! for the files. Please refer to }(hjhhhNhNubh)}(hK:ref:`intervals_goal section `h]jq)}(hjdh]hintervals_goal section}(hjfhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjbubah}(h]h ]h"]h$]h&]refdocj refdomainjpreftyperef refexplicitrefwarnj+damon_usage_sysfs_monitoring_intervals_goaluh1hhhhKhjubh for more details.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(hw``commit_schemes_quota_goals``: Read the DAMON-based operation schemes' :ref:`quota goals `.h]h)}(hw``commit_schemes_quota_goals``: Read the DAMON-based operation schemes' :ref:`quota goals `.h](j_)}(h``commit_schemes_quota_goals``h]hcommit_schemes_quota_goals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh,: Read the DAMON-based operation schemes’ }(hjhhhNhNubh)}(h.:ref:`quota goals `h]jq)}(hjh]h quota goals}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_schemes_quota_goalsuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(h``update_schemes_stats``: Update the contents of stats files for each DAMON-based operation scheme of the kdamond. For details of the stats, please refer to :ref:`stats section `.h]h)}(h``update_schemes_stats``: Update the contents of stats files for each DAMON-based operation scheme of the kdamond. For details of the stats, please refer to :ref:`stats section `.h](j_)}(h``update_schemes_stats``h]hupdate_schemes_stats}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh: Update the contents of stats files for each DAMON-based operation scheme of the kdamond. For details of the stats, please refer to }(hjhhhNhNubh)}(h*:ref:`stats section `h]jq)}(hjh]h stats section}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjsysfs_schemes_statsuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(hX;``update_schemes_tried_regions``: Update the DAMON-based operation scheme action tried regions directory for each DAMON-based operation scheme of the kdamond. For details of the DAMON-based operation scheme action tried regions directory, please refer to :ref:`tried_regions section `.h]h)}(hX;``update_schemes_tried_regions``: Update the DAMON-based operation scheme action tried regions directory for each DAMON-based operation scheme of the kdamond. For details of the DAMON-based operation scheme action tried regions directory, please refer to :ref:`tried_regions section `.h](j_)}(h ``update_schemes_tried_regions``h]hupdate_schemes_tried_regions}(hj. hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj* ubh: Update the DAMON-based operation scheme action tried regions directory for each DAMON-based operation scheme of the kdamond. For details of the DAMON-based operation scheme action tried regions directory, please refer to }(hj* hhhNhNubh)}(h::ref:`tried_regions section `h]jq)}(hjB h]htried_regions section}(hjD hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj@ ubah}(h]h ]h"]h$]h&]refdocj refdomainjN reftyperef refexplicitrefwarnjsysfs_schemes_tried_regionsuh1hhhhKhj* ubh.}(hj* hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj& ubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(hT``update_schemes_tried_bytes``: Update only ``.../tried_regions/total_bytes`` files.h]h)}(hT``update_schemes_tried_bytes``: Update only ``.../tried_regions/total_bytes`` files.h](j_)}(h``update_schemes_tried_bytes``h]hupdate_schemes_tried_bytes}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjt ubh: Update only }(hjt hhhNhNubj_)}(h!``.../tried_regions/total_bytes``h]h.../tried_regions/total_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjt ubh files.}(hjt hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjp ubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(h``clear_schemes_tried_regions``: Clear the DAMON-based operating scheme action tried regions directory for each DAMON-based operation scheme of the kdamond.h]h)}(h``clear_schemes_tried_regions``: Clear the DAMON-based operating scheme action tried regions directory for each DAMON-based operation scheme of the kdamond.h](j_)}(h``clear_schemes_tried_regions``h]hclear_schemes_tried_regions}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh}: Clear the DAMON-based operating scheme action tried regions directory for each DAMON-based operation scheme of the kdamond.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubh)}(h``update_schemes_effective_quotas``: Update the contents of ``effective_bytes`` files for each DAMON-based operation scheme of the kdamond. For more details, refer to :ref:`quotas directory `. h]h)}(h``update_schemes_effective_quotas``: Update the contents of ``effective_bytes`` files for each DAMON-based operation scheme of the kdamond. For more details, refer to :ref:`quotas directory `.h](j_)}(h#``update_schemes_effective_quotas``h]hupdate_schemes_effective_quotas}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh: Update the contents of }(hj hhhNhNubj_)}(h``effective_bytes``h]heffective_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhY files for each DAMON-based operation scheme of the kdamond. For more details, refer to }(hj hhhNhNubh)}(h&:ref:`quotas directory `h]jq)}(hj h]hquotas directory}(hj hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj sysfs_quotasuh1hhhhKhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhNubeh}(h]h ]h"]h$]h&]j7j8uh1hhhhKhjhhubh)}(hLIf the state is ``on``, reading ``pid`` shows the pid of the kdamond thread.h](hIf the state is }(hj0 hhhNhNubj_)}(h``on``h]hon}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj0 ubh , reading }(hj0 hhhNhNubj_)}(h``pid``h]hpid}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj0 ubh% shows the pid of the kdamond thread.}(hj0 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hm``contexts`` directory contains files for controlling the monitoring contexts that this kdamond will execute.h](j_)}(h ``contexts``h]hcontexts}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjb ubha directory contains files for controlling the monitoring contexts that this kdamond will execute.}(hjb hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h.. _sysfs_contexts:h]h}(h]h ]h"]h$]h&]jCsysfs-contextsuh1jhKhjhhhhubeh}(h]( kdamonds-njeh ]h"]( kdamonds// sysfs_kdamondeh$]h&]uh1hhjEhhhhhKzj}j jsj}jjsubh)}(hhh](h)}(hkdamonds//contexts/h]hkdamonds//contexts/}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXIn the beginning, this directory has only one file, ``nr_contexts``. Writing a number (``N``) to the file creates the number of child directories named as ``0`` to ``N-1``. Each directory represents each monitoring context (refer to :ref:`design ` for more details). At the moment, only one context per kdamond is supported, so only ``0`` or ``1`` can be written to the file.h](h4In the beginning, this directory has only one file, }(hj hhhNhNubj_)}(h``nr_contexts``h]h nr_contexts}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh. Writing a number (}(hj hhhNhNubj_)}(h``N``h]hN}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh?) to the file creates the number of child directories named as }(hj hhhNhNubj_)}(h``0``h]h0}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh to }(hj hhhNhNubj_)}(h``N-1``h]hN-1}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh?. Each directory represents each monitoring context (refer to }(hj hhhNhNubh)}(h@:ref:`design `h]jq)}(hj h]hdesign}(hj hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj0damon_design_execution_model_and_data_structuresuh1hhhhKhj ubhW for more details). At the moment, only one context per kdamond is supported, so only }(hj hhhNhNubj_)}(h``0``h]h0}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh or }(hj hhhNhNubj_)}(h``1``h]h1}(hj+ hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh can be written to the file.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h.. _sysfs_context:h]h}(h]h ]h"]h$]h&]jC sysfs-contextuh1jhKhj hhhhubeh}(h](kdamonds-n-contextsj eh ]h"](kdamonds//contexts/sysfs_contextseh$]h&]uh1hhjEhhhhhKj}jT j~ sj}j j~ subh)}(hhh](h)}(h contexts//h]h contexts//}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjY hhhhhKubh)}(hIn each context directory, two files (``avail_operations`` and ``operations``) and three directories (``monitoring_attrs``, ``targets``, and ``schemes``) exist.h](h&In each context directory, two files (}(hjj hhhNhNubj_)}(h``avail_operations``h]havail_operations}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjj ubh and }(hjj hhhNhNubj_)}(h``operations``h]h operations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjj ubh) and three directories (}(hjj hhhNhNubj_)}(h``monitoring_attrs``h]hmonitoring_attrs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjj ubh, }(hjj hhhNhNubj_)}(h ``targets``h]htargets}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjj ubh, and }(hjj hhhNhNubj_)}(h ``schemes``h]hschemes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjj ubh) exist.}(hjj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjY hhubh)}(hXDAMON supports multiple types of :ref:`monitoring operations `, including those for virtual address space and the physical address space. You can get the list of available monitoring operations set on the currently running kernel by reading ``avail_operations`` file. Based on the kernel configuration, the file will list different available operation sets. Please refer to the :ref:`design ` for the list of all available operation sets and their brief explanations.h](h!DAMON supports multiple types of }(hj hhhNhNubh)}(hG:ref:`monitoring operations `h]jq)}(hj h]hmonitoring operations}(hj hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj(damon_design_configurable_operations_setuh1hhhhKhj ubh, including those for virtual address space and the physical address space. You can get the list of available monitoring operations set on the currently running kernel by reading }(hj hhhNhNubj_)}(h``avail_operations``h]havail_operations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhw file. Based on the kernel configuration, the file will list different available operation sets. Please refer to the }(hj hhhNhNubh)}(h$:ref:`design `h]jq)}(hj h]hdesign}(hj hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjdamon_operations_setuh1hhhhKhj ubhK for the list of all available operation sets and their brief explanations.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjY hhubh)}(hYou can set and get what type of monitoring operations DAMON will use for the context by writing one of the keywords listed in ``avail_operations`` file and reading from the ``operations`` file.h](hYou can set and get what type of monitoring operations DAMON will use for the context by writing one of the keywords listed in }(hj: hhhNhNubj_)}(h``avail_operations``h]havail_operations}(hjB hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj: ubh file and reading from the }(hj: hhhNhNubj_)}(h``operations``h]h operations}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj: ubh file.}(hj: hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjY hhubj)}(h.. _sysfs_monitoring_attrs:h]h}(h]h ]h"]h$]h&]jCsysfs-monitoring-attrsuh1jhKhjY hhhhubeh}(h]( contexts-njM eh ]h"]( contexts// sysfs_contexteh$]h&]uh1hhjEhhhhhKj}j} jC sj}jM jC subh)}(hhh](h)}(hcontexts//monitoring_attrs/h]hcontexts//monitoring_attrs/}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hFiles for specifying attributes of the monitoring including required quality and efficiency of the monitoring are in ``monitoring_attrs`` directory. Specifically, two directories, ``intervals`` and ``nr_regions`` exist in this directory.h](huFiles for specifying attributes of the monitoring including required quality and efficiency of the monitoring are in }(hj hhhNhNubj_)}(h``monitoring_attrs``h]hmonitoring_attrs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh+ directory. Specifically, two directories, }(hj hhhNhNubj_)}(h ``intervals``h]h intervals}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }(hj hhhNhNubj_)}(h``nr_regions``h]h nr_regions}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh exist in this directory.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXUnder ``intervals`` directory, three files for DAMON's sampling interval (``sample_us``), aggregation interval (``aggr_us``), and update interval (``update_us``) exist. You can set and get the values in micro-seconds by writing to and reading from the files.h](hUnder }(hj hhhNhNubj_)}(h ``intervals``h]h intervals}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh9 directory, three files for DAMON’s sampling interval (}(hj hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh), aggregation interval (}(hj hhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh), and update interval (}(hj hhhNhNubj_)}(h ``update_us``h]h update_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhc) exist. You can set and get the values in micro-seconds by writing to and reading from the files.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXUnder ``nr_regions`` directory, two files for the lower-bound and upper-bound of DAMON's monitoring regions (``min`` and ``max``, respectively), which controls the monitoring overhead, exist. You can set and get the values by writing to and rading from the files.h](hUnder }(hj- hhhNhNubj_)}(h``nr_regions``h]h nr_regions}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj- ubh[ directory, two files for the lower-bound and upper-bound of DAMON’s monitoring regions (}(hj- hhhNhNubj_)}(h``min``h]hmin}(hjG hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj- ubh and }(hj- hhhNhNubj_)}(h``max``h]hmax}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj- ubh, respectively), which controls the monitoring overhead, exist. You can set and get the values by writing to and rading from the files.}(hj- hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hFor more details about the intervals and monitoring regions range, please refer to the Design document (:doc:`/mm/damon/design`).h](hhFor more details about the intervals and monitoring regions range, please refer to the Design document (}(hjq hhhNhNubh)}(h:doc:`/mm/damon/design`h]jq)}(hj{ h]h/mm/damon/design}(hj} hhhNhNubah}(h]h ](j|stdstd-doceh"]h$]h&]uh1jphjy ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftypedoc refexplicitrefwarnj/mm/damon/designuh1hhhhKhjq ubh).}(hjq hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h0.. _damon_usage_sysfs_monitoring_intervals_goal:h]h}(h]h ]h"]h$]h&]jC+damon-usage-sysfs-monitoring-intervals-goaluh1jhKhj hhhhubeh}(h](contexts-n-monitoring-attrsjv eh ]h"](contexts//monitoring_attrs/sysfs_monitoring_attrseh$]h&]uh1hhjEhhhhhKj}j jl sj}jv jl subh)}(hhh](h)}(h7contexts//monitoring_attrs/intervals/intervals_goal/h]h7contexts//monitoring_attrs/intervals/intervals_goal/}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXUnder the ``intervals`` directory, one directory for automated tuning of ``sample_us`` and ``aggr_us``, namely ``intervals_goal`` directory also exists. Under the directory, four files for the auto-tuning control, namely ``access_bp``, ``aggrs``, ``min_sample_us`` and ``max_sample_us`` exist. Please refer to the :ref:`design document of the feature ` for the internal of the tuning mechanism. Reading and writing the four files under ``intervals_goal`` directory shows and updates the tuning parameters that described in the :ref:design doc ` with the same names. The tuning starts with the user-set ``sample_us`` and ``aggr_us``. The tuning-applied current values of the two intervals can be read from the ``sample_us`` and ``aggr_us`` files after writing ``update_tuned_intervals`` to the ``state`` file.h](h Under the }(hj hhhNhNubj_)}(h ``intervals``h]h intervals}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh2 directory, one directory for automated tuning of }(hj hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }(hj hhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh , namely }(hj hhhNhNubj_)}(h``intervals_goal``h]hintervals_goal}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh\ directory also exists. Under the directory, four files for the auto-tuning control, namely }(hj hhhNhNubj_)}(h ``access_bp``h]h access_bp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, }(hj hhhNhNubj_)}(h ``aggrs``h]haggrs}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, }hj sbj_)}(h``min_sample_us``h]h min_sample_us}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }hj sbj_)}(h``max_sample_us``h]h max_sample_us}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh exist. Please refer to the }(hj hhhNhNubh)}(hT:ref:`design document of the feature `h]jq)}(hjdh]hdesign document of the feature}(hjfhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjbubah}(h]h ]h"]h$]h&]refdocj refdomainjpreftyperef refexplicitrefwarnj,damon_design_monitoring_intervals_autotuninguh1hhhhKhj ubhU for the internal of the tuning mechanism. Reading and writing the four files under }(hj hhhNhNubj_)}(h``intervals_goal``h]hintervals_goal}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh directory shows and updates the tuning parameters that described in the :ref:design doc ` with the same names. The tuning starts with the user-set }(hj hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }hj sbj_)}(h ``aggr_us``h]haggr_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhO. The tuning-applied current values of the two intervals can be read from the }(hj hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }hj sbj_)}(h ``aggr_us``h]haggr_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh files after writing }(hj hhhNhNubj_)}(h``update_tuned_intervals``h]hupdate_tuned_intervals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh to the }(hj hhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h.. _sysfs_targets:h]h}(h]h ]h"]h$]h&]jC sysfs-targetsuh1jhKhj hhhhubeh}(h](4contexts-n-monitoring-attrs-intervals-intervals-goalj eh ]h"](7contexts//monitoring_attrs/intervals/intervals_goal/+damon_usage_sysfs_monitoring_intervals_goaleh$]h&]uh1hhjEhhhhhKj}jj sj}j j subh)}(hhh](h)}(hcontexts//targets/h]hcontexts//targets/}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hIn the beginning, this directory has only one file, ``nr_targets``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each monitoring target.h](h4In the beginning, this directory has only one file, }(hj1hhhNhNubj_)}(h``nr_targets``h]h nr_targets}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh. Writing a number (}(hj1hhhNhNubj_)}(h``N``h]hN}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh<) to the file creates the number of child directories named }(hj1hhhNhNubj_)}(h``0``h]h0}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh to }(hj1hhhNhNubj_)}(h``N-1``h]hN-1}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh4. Each directory represents each monitoring target.}(hj1hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h.. _sysfs_target:h]h}(h]h ]h"]h$]h&]jC sysfs-targetuh1jhKhj hhhhubeh}(h](contexts-n-targetsjeh ]h"](contexts//targets/ sysfs_targetseh$]h&]uh1hhjEhhhhhKj}jj sj}jj subh)}(hhh](h)}(h targets//h]h targets//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hZIn each target directory, one file (``pid_target``) and one directory (``regions``) exist.h](h$In each target directory, one file (}(hjhhhNhNubj_)}(h``pid_target``h]h pid_target}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and one directory (}(hjhhhNhNubj_)}(h ``regions``h]hregions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hIf you wrote ``vaddr`` to the ``contexts//operations``, each target should be a process. You can specify the process to DAMON by writing the pid of the process to the ``pid_target`` file.h](h If you wrote }(hjhhhNhNubj_)}(h ``vaddr``h]hvaddr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to the }(hjhhhNhNubj_)}(h``contexts//operations``h]hcontexts//operations}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhr, each target should be a process. You can specify the process to DAMON by writing the pid of the process to the }(hjhhhNhNubj_)}(h``pid_target``h]h pid_target}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _sysfs_regions:h]h}(h]h ]h"]h$]h&]jC sysfs-regionsuh1jhMhjhhhhubeh}(h]( targets-njeh ]h"]( targets// sysfs_targeteh$]h&]uh1hhjEhhhhhKj}j5jsj}jjsubh)}(hhh](h)}(htargets//regionsh]htargets//regions}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hhhhhM ubh)}(hXvIn case of ``fvaddr`` or ``paddr`` monitoring operations sets, users are required to set the monitoring target address ranges. In case of ``vaddr`` operations set, it is not mandatory, but users can optionally set the initial monitoring region to specific address ranges. Please refer to the :ref:`design ` for more details.h](h In case of }(hjKhhhNhNubj_)}(h ``fvaddr``h]hfvaddr}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubh or }(hjKhhhNhNubj_)}(h ``paddr``h]hpaddr}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubhi monitoring operations sets, users are required to set the monitoring target address ranges. In case of }(hjKhhhNhNubj_)}(h ``vaddr``h]hvaddr}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubh operations set, it is not mandatory, but users can optionally set the initial monitoring region to specific address ranges. Please refer to the }(hjKhhhNhNubh)}(h>:ref:`design `h]jq)}(hjh]hdesign}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj.damon_design_vaddr_target_regions_constructionuh1hhhhM hjKubh for more details.}(hjKhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj:hhubh)}(hFor such cases, users can explicitly set the initial monitoring target regions as they want, by writing proper values to the files under this directory.h]hFor such cases, users can explicitly set the initial monitoring target regions as they want, by writing proper values to the files under this directory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:hhubh)}(hIn the beginning, this directory has only one file, ``nr_regions``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each initial monitoring target region.h](h4In the beginning, this directory has only one file, }(hjhhhNhNubj_)}(h``nr_regions``h]h nr_regions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. Writing a number (}(hjhhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh<) to the file creates the number of child directories named }(hjhhhNhNubj_)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhC. Each directory represents each initial monitoring target region.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj:hhubj)}(h.. _sysfs_region:h]h}(h]h ]h"]h$]h&]jC sysfs-regionuh1jhMhj:hhhhubeh}(h](targets-n-regionsj.eh ]h"](targets//regions sysfs_regionseh$]h&]uh1hhjEhhhhhM j}j(j$sj}j.j$subh)}(hhh](h)}(h regions//h]h regions//}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj-hhhhhMubh)}(hIn each region directory, you will find two files (``start`` and ``end``). You can set and get the start and end addresses of the initial monitoring target region by writing to and reading from the files, respectively.h](h3In each region directory, you will find two files (}(hj>hhhNhNubj_)}(h ``start``h]hstart}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj>ubh and }(hj>hhhNhNubj_)}(h``end``h]hend}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj>ubh). You can set and get the start and end addresses of the initial monitoring target region by writing to and reading from the files, respectively.}(hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj-hhubh)}(hEach region should not overlap with others. ``end`` of directory ``N`` should be equal or smaller than ``start`` of directory ``N+1``.h](h-Each region should not overlap with others. }(hjphhhNhNubj_)}(h``end``h]hend}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjpubh of directory }(hjphhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjpubh! should be equal or smaller than }(hjphhhNhNubj_)}(h ``start``h]hstart}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjpubh of directory }hjpsbj_)}(h``N+1``h]hN+1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjpubh.}(hjphhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM!hj-hhubj)}(h.. _sysfs_schemes:h]h}(h]h ]h"]h$]h&]jC sysfs-schemesuh1jhM$hj-hhhhubeh}(h]( regions-nj!eh ]h"]( regions// sysfs_regioneh$]h&]uh1hhjEhhhhhMj}jjsj}j!jsubh)}(hhh](h)}(hcontexts//schemes/h]hcontexts//schemes/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM'ubh)}(hThe directory for DAMON-based Operation Schemes (:ref:`DAMOS `). Users can get and set the schemes by reading from and writing to files under this directory.h](h1The directory for DAMON-based Operation Schemes (}(hjhhhNhNubh)}(h!:ref:`DAMOS `h]jq)}(hjh]hDAMOS}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhM)hjubh`). Users can get and set the schemes by reading from and writing to files under this directory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM)hjhhubh)}(hIn 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`` to ``N-1``. Each directory represents each DAMON-based operation scheme.h](h4In the beginning, this directory has only one file, }(hjhhhNhNubj_)}(h``nr_schemes``h]h nr_schemes}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. Writing a number (}(hjhhhNhNubj_)}(h``N``h]hN}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh<) to the file creates the number of child directories named }(hjhhhNhNubj_)}(h``0``h]h0}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h``N-1``h]hN-1}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh?. Each directory represents each DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM-hjhhubj)}(h.. _sysfs_scheme:h]h}(h]h ]h"]h$]h&]jC sysfs-schemeuh1jhM1hjhhhhubeh}(h](contexts-n-schemesjeh ]h"](contexts//schemes/ sysfs_schemeseh$]h&]uh1hhjEhhhhhM'j}jjsj}jjsubh)}(hhh](h)}(h schemes//h]h schemes//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM4ubh)}(hIn each scheme directory, seven directories (``access_pattern``, ``quotas``, ``watermarks``, ``core_filters``, ``ops_filters``, ``filters``, ``stats``, and ``tried_regions``) and three files (``action``, ``target_nid`` and ``apply_interval``) exist.h](h-In each scheme directory, seven directories (}(hjhhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``quotas``h]hquotas}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``watermarks``h]h watermarks}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``core_filters``h]h core_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``ops_filters``h]h ops_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h ``filters``h]hfilters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h ``stats``h]hstats}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``tried_regions``h]h tried_regions}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and three files (}(hjhhhNhNubj_)}(h ``action``h]haction}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``target_nid``h]h target_nid}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``apply_interval``h]happly_interval}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM6hjhhubh)}(hXThe ``action`` file is for setting and getting the scheme's :ref:`action `. The keywords that can be written to and read from the file and their meaning are same to those of the list on :ref:`design doc `.h](hThe }(hjphhhNhNubj_)}(h ``action``h]haction}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjpubh0 file is for setting and getting the scheme’s }(hjphhhNhNubh)}(h):ref:`action `h]jq)}(hjh]haction}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_actionuh1hhhhM;hjpubhq. The keywords that can be written to and read from the file and their meaning are same to those of the list on }(hjphhhNhNubh)}(h-:ref:`design doc `h]jq)}(hjh]h design doc}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_actionuh1hhhhM;hjpubh.}(hjphhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM;hjhhubh)}(hThe ``target_nid`` file is for setting the migration target node, which is only meaningful when the ``action`` is either ``migrate_hot`` or ``migrate_cold``.h](hThe }(hjhhhNhNubj_)}(h``target_nid``h]h target_nid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhR file is for setting the migration target node, which is only meaningful when the }(hjhhhNhNubj_)}(h ``action``h]haction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh is either }(hjhhhNhNubj_)}(h``migrate_hot``h]h migrate_hot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh or }(hjhhhNhNubj_)}(h``migrate_cold``h]h migrate_cold}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hjhhubh)}(hThe ``apply_interval_us`` file is for setting and getting the scheme's :ref:`apply_interval ` in microseconds.h](hThe }(hj.hhhNhNubj_)}(h``apply_interval_us``h]happly_interval_us}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj.ubh0 file is for setting and getting the scheme’s }(hj.hhhNhNubh)}(h*:ref:`apply_interval `h]jq)}(hjJh]happly_interval}(hjLhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjHubah}(h]h ]h"]h$]h&]refdocj refdomainjVreftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhMDhj.ubh in microseconds.}(hj.hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMDhjhhubj)}(h.. _sysfs_access_pattern:h]h}(h]h ]h"]h$]h&]jCsysfs-access-patternuh1jhMGhjhhhhubeh}(h]( schemes-njeh ]h"]( schemes// sysfs_schemeeh$]h&]uh1hhjEhhhhhM4j}jjusj}jjusubh)}(hhh](h)}(hschemes//access_pattern/h]hschemes//access_pattern/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMJubh)}(hThe directory for the target access :ref:`pattern ` of the given DAMON-based operation scheme.h](h$The directory for the target access }(hjhhhNhNubh)}(h2:ref:`pattern `h]jq)}(hjh]hpattern}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj!damon_design_damos_access_patternuh1hhhhMLhjubh+ of the given DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjhhubh)}(hXUnder the ``access_pattern`` directory, three directories (``sz``, ``nr_accesses``, and ``age``) each having two files (``min`` and ``max``) exist. You can set and get the access pattern for the given scheme by writing to and reading from the ``min`` and ``max`` files under ``sz``, ``nr_accesses``, and ``age`` directories, respectively. Note that the ``min`` and the ``max`` form a closed interval.h](h Under the }(hjhhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory, three directories (}(hjhhhNhNubj_)}(h``sz``h]hsz}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``age``h]hage}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) each having two files (}(hjhhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``max``h]hmax}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhi) exist. You can set and get the access pattern for the given scheme by writing to and reading from the }(hjhhhNhNubj_)}(h``min``h]hmin}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }hjsbj_)}(h``max``h]hmax}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh files under }(hjhhhNhNubj_)}(h``sz``h]hsz}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``nr_accesses``h]h nr_accesses}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }hjsbj_)}(h``age``h]hage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh+ directories, respectively. Note that the }(hjhhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and the }(hjhhhNhNubj_)}(h``max``h]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh form a closed interval.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMOhjhhubj)}(h.. _sysfs_quotas:h]h}(h]h ]h"]h$]h&]jC sysfs-quotasuh1jhMVhjhhhhubeh}(h](schemes-n-access-patternj|eh ]h"](schemes//access_pattern/sysfs_access_patterneh$]h&]uh1hhjEhhhhhMJj}jjrsj}j|jrsubh)}(hhh](h)}(hschemes//quotas/h]hschemes//quotas/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMYubh)}(hjThe directory for the :ref:`quotas ` of the given DAMON-based operation scheme.h](hThe directory for the }(hjhhhNhNubh)}(h):ref:`quotas `h]jq)}(hjh]hquotas}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_quotasuh1hhhhM[hjubh+ of the given DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM[hjhhubh)}(hUnder ``quotas`` directory, four files (``ms``, ``bytes``, ``reset_interval_ms``, ``effective_bytes``) and two directores (``weights`` and ``goals``) exist.h](hUnder }(hjhhhNhNubj_)}(h ``quotas``h]hquotas}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory, four files (}(hjhhhNhNubj_)}(h``ms``h]hms}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``bytes``h]hbytes}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``reset_interval_ms``h]hreset_interval_ms}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``effective_bytes``h]heffective_bytes}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and two directores (}(hjhhhNhNubj_)}(h ``weights``h]hweights}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h ``goals``h]hgoals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM^hjhhubh)}(hX!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, respectively. Then, DAMON tries to use only up to ``time quota`` milliseconds for applying the ``action`` to memory regions of the ``access_pattern``, and to apply the action to only up to ``bytes`` bytes of memory regions within the ``reset_interval_ms``. Setting both ``ms`` and ``bytes`` zero disables the quota limits unless at least one :ref:`goal ` is set.h](hYou can set the }(hjhhhNhNubj_)}(h``time quota``h]h time quota}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh in milliseconds, }(hjhhhNhNubj_)}(h``size quota``h]h size quota}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh in bytes, and }(hjhhhNhNubj_)}(h``reset interval``h]hreset interval}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhn in milliseconds by writing the values to the three files, respectively. Then, DAMON tries to use only up to }(hjhhhNhNubj_)}(h``time quota``h]h time quota}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh milliseconds for applying the }(hjhhhNhNubj_)}(h ``action``h]haction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to memory regions of the }(hjhhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh(, and to apply the action to only up to }(hjhhhNhNubj_)}(h ``bytes``h]hbytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh$ bytes of memory regions within the }(hjhhhNhNubj_)}(h``reset_interval_ms``h]hreset_interval_ms}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. Setting both }(hjhhhNhNubj_)}(h``ms``h]hms}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h ``bytes``h]hbytes}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh4 zero disables the quota limits unless at least one }(hjhhhNhNubh)}(h':ref:`goal `h]jq)}(hjfh]hgoal}(hjhhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjdubah}(h]h ]h"]h$]h&]refdocj refdomainjrreftyperef refexplicitrefwarnjsysfs_schemes_quota_goalsuh1hhhhMbhjubh is set.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMbhjhhubh)}(hX>The time quota is internally transformed to a size quota. Between the transformed size quota and user-specified size quota, smaller one is applied. Based on the user-specified :ref:`goal `, the effective size quota is further adjusted. Reading ``effective_bytes`` returns the current effective size quota. The file is not updated in real time, so users should ask DAMON sysfs interface to update the content of the file for the stats by writing a special keyword, ``update_schemes_effective_quotas`` to the relevant ``kdamonds//state`` file.h](hThe time quota is internally transformed to a size quota. Between the transformed size quota and user-specified size quota, smaller one is applied. Based on the user-specified }(hjhhhNhNubh)}(h':ref:`goal `h]jq)}(hjh]hgoal}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsysfs_schemes_quota_goalsuh1hhhhMkhjubh9, the effective size quota is further adjusted. Reading }(hjhhhNhNubj_)}(h``effective_bytes``h]heffective_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh returns the current effective size quota. The file is not updated in real time, so users should ask DAMON sysfs interface to update the content of the file for the stats by writing a special keyword, }(hjhhhNhNubj_)}(h#``update_schemes_effective_quotas``h]hupdate_schemes_effective_quotas}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to the relevant }(hjhhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMkhjhhubh)}(hXGUnder ``weights`` directory, three files (``sz_permil``, ``nr_accesses_permil``, and ``age_permil``) exist. You can set the :ref:`prioritization weights ` for size, access frequency, and age in per-thousand unit by writing the values to the three files under the ``weights`` directory.h](hUnder }(hjhhhNhNubj_)}(h ``weights``h]hweights}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory, three files (}(hjhhhNhNubj_)}(h ``sz_permil``h]h sz_permil}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``nr_accesses_permil``h]hnr_accesses_permil}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``age_permil``h]h age_permil}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist. You can set the }(hjhhhNhNubh)}(hH:ref:`prioritization weights `h]jq)}(hjHh]hprioritization weights}(hjJhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjFubah}(h]h ]h"]h$]h&]refdocj refdomainjTreftyperef refexplicitrefwarnj(damon_design_damos_quotas_prioritizationuh1hhhhMthjubhm for size, access frequency, and age in per-thousand unit by writing the values to the three files under the }(hjhhhNhNubj_)}(h ``weights``h]hweights}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMthjhhubj)}(h.. _sysfs_schemes_quota_goals:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-quota-goalsuh1jhM{hjhhhhubeh}(h](schemes-n-quotasjeh ]h"](schemes//quotas/ sysfs_quotaseh$]h&]uh1hhjEhhhhhMYj}jjsj}jjsubh)}(hhh](h)}(hschemes//quotas/goals/h]hschemes//quotas/goals/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM~ubh)}(hThe directory for the :ref:`automatic quota tuning goals ` of the given DAMON-based operation scheme.h](hThe directory for the }(hjhhhNhNubh)}(hK:ref:`automatic quota tuning goals `h]jq)}(hjh]hautomatic quota tuning goals}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj%damon_design_damos_quotas_auto_tuninguh1hhhhMhjubh+ of the given DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXIn the beginning, this directory has only one file, ``nr_goals``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each goal and current achievement. Among the multiple feedback, the best one is used.h](h4In the beginning, this directory has only one file, }(hjhhhNhNubj_)}(h ``nr_goals``h]hnr_goals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. Writing a number (}(hjhhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh<) to the file creates the number of child directories named }(hjhhhNhNubj_)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhr. Each directory represents each goal and current achievement. Among the multiple feedback, the best one is used.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXEach goal directory contains three files, namely ``target_metric``, ``target_value`` and ``current_value``. Users can set and get the three parameters for the quota auto-tuning goals that specified on the :ref:`design doc ` by writing to and reading from each of the files. Note that users should further write ``commit_schemes_quota_goals`` to the ``state`` file of the :ref:`kdamond directory ` to pass the feedback to DAMON.h](h1Each goal directory contains three files, namely }(hj1hhhNhNubj_)}(h``target_metric``h]h target_metric}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh, }(hj1hhhNhNubj_)}(h``target_value``h]h target_value}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh and }(hj1hhhNhNubj_)}(h``current_value``h]h current_value}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubhd. Users can set and get the three parameters for the quota auto-tuning goals that specified on the }(hj1hhhNhNubh)}(h9:ref:`design doc `h]jq)}(hjqh]h design doc}(hjshhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjoubah}(h]h ]h"]h$]h&]refdocj refdomainj}reftyperef refexplicitrefwarnj%damon_design_damos_quotas_auto_tuninguh1hhhhMhj1ubhY by writing to and reading from each of the files. Note that users should further write }(hj1hhhNhNubj_)}(h``commit_schemes_quota_goals``h]hcommit_schemes_quota_goals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh to the }(hj1hhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1ubh file of the }(hj1hhhNhNubh)}(h(:ref:`kdamond directory `h]jq)}(hjh]hkdamond directory}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sysfs_kdamonduh1hhhhMhj1ubh to pass the feedback to DAMON.}(hj1hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _sysfs_watermarks:h]h}(h]h ]h"]h$]h&]jCsysfs-watermarksuh1jhMhjhhhhubeh}(h](schemes-n-quotas-goalsjeh ]h"](schemes//quotas/goals/sysfs_schemes_quota_goalseh$]h&]uh1hhjEhhhhhM~j}jjsj}jjsubh)}(hhh](h)}(hschemes//watermarks/h]hschemes//watermarks/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hrThe directory for the :ref:`watermarks ` of the given DAMON-based operation scheme.h](hThe directory for the }(hjhhhNhNubh)}(h1:ref:`watermarks `h]jq)}(hjh]h watermarks}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_watermarksuh1hhhhMhjubh+ of the given DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXUnder the watermarks directory, five files (``metric``, ``interval_us``, ``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.h](h,Under the watermarks directory, five files (}(hj:hhhNhNubj_)}(h ``metric``h]hmetric}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh, }(hj:hhhNhNubj_)}(h``interval_us``h]h interval_us}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh, }(hj:hhhNhNubj_)}(h``high``h]hhigh}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh, }hj:sbj_)}(h``mid``h]hmid}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh, and }(hj:hhhNhNubj_)}(h``low``h]hlow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh) 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.}(hj:hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hWKeywords and meanings of those that can be written to the ``metric`` file are as below.h](h:Keywords and meanings of those that can be written to the }(hjhhhNhNubj_)}(h ``metric``h]hmetric}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file are as below.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh block_quote)}(hX- none: Ignore the watermarks - free_mem_rate: System's free memory rate (per thousand) h]h)}(hhh](h)}(hnone: Ignore the watermarksh]h)}(hjh]hnone: Ignore the watermarks}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h8free_mem_rate: System's free memory rate (per thousand) h]h)}(h7free_mem_rate: System's free memory rate (per thousand)h]h9free_mem_rate: System’s free memory rate (per thousand)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]j7j8uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhjhhubh)}(h5The ``interval`` should written in microseconds unit.h](hThe }(hjhhhNhNubj_)}(h ``interval``h]hinterval}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh% should written in microseconds unit.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _sysfs_filters:h]h}(h]h ]h"]h$]h&]jC sysfs-filtersuh1jhMhjhhhhubeh}(h](schemes-n-watermarksjeh ]h"](schemes//watermarks/sysfs_watermarkseh$]h&]uh1hhjEhhhhhMj}j7jsj}jjsubh)}(hhh](h)}(h#schemes//{core\_,ops\_,}filters/h]h#schemes//{core_,ops_,}filters/}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj<hhhhhMubh)}(hfDirectories for :ref:`filters ` of the given DAMON-based operation scheme.h](hDirectories for }(hjMhhhNhNubh)}(h+:ref:`filters `h]jq)}(hjWh]hfilters}(hjYhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjUubah}(h]h ]h"]h$]h&]refdocj refdomainjcreftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhjMubh+ of the given DAMON-based operation scheme.}(hjMhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hX``core_filters`` and ``ops_filters`` directories are for the filters handled by the DAMON core layer and operations set layer, respectively. ``filters`` directory can be used for installing filters regardless of their handled layers. Filters that requested by ``core_filters`` and ``ops_filters`` will be installed before those of ``filters``. All three directories have same files.h](j_)}(h``core_filters``h]h core_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``ops_filters``h]h ops_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhj directories are for the filters handled by the DAMON core layer and operations set layer, respectively. }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhm directory can be used for installing filters regardless of their handled layers. Filters that requested by }(hjhhhNhNubj_)}(h``core_filters``h]h core_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }hjsbj_)}(h``ops_filters``h]h ops_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh# will be installed before those of }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh). All three directories have same files.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hXUse of ``filters`` directory can make expecting evaluation orders of given filters with the files under directory bit confusing. Users are hence recommended to use ``core_filters`` and ``ops_filters`` directories. The ``filters`` directory could be deprecated in future.h](hUse of }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory can make expecting evaluation orders of given filters with the files under directory bit confusing. Users are hence recommended to use }(hjhhhNhNubj_)}(h``core_filters``h]h core_filters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``ops_filters``h]h ops_filters}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directories. The }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) directory could be deprecated in future.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hXIn the beginning, the directory has only one file, ``nr_filters``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each filter. The filters are evaluated in the numeric order.h](h3In the beginning, the directory has only one file, }(hjKhhhNhNubj_)}(h``nr_filters``h]h nr_filters}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubh. Writing a number (}(hjKhhhNhNubj_)}(h``N``h]hN}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubh<) to the file creates the number of child directories named }(hjKhhhNhNubj_)}(h``0``h]h0}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubh to }(hjKhhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjKubhZ. Each directory represents each filter. The filters are evaluated in the numeric order.}(hjKhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hXiEach filter directory contains nine files, namely ``type``, ``matching``, ``allow``, ``memcg_path``, ``addr_start``, ``addr_end``, ``min``, ``max`` and ``target_idx``. To ``type`` file, you can write the type of the filter. Refer to :ref:`the design doc ` for available type names, their meaning and on what layer those are handled.h](h2Each filter directory contains nine files, namely }(hjhhhNhNubj_)}(h``type``h]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``matching``h]hmatching}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``allow``h]hallow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``memcg_path``h]h memcg_path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``addr_start``h]h addr_start}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h ``addr_end``h]haddr_end}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``max``h]hmax}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``target_idx``h]h target_idx}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. To }(hjhhhNhNubj_)}(h``type``h]htype}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh6 file, you can write the type of the filter. Refer to }(hjhhhNhNubh)}(h2:ref:`the design doc `h]jq)}(hj_h]hthe design doc}(hjahhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj]ubah}(h]h ]h"]h$]h&]refdocj refdomainjkreftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhjubhM for available type names, their meaning and on what layer those are handled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hXgFor ``memcg`` type, you can specify the memory cgroup of the interest by writing the path of the memory cgroup from the cgroups mount point to ``memcg_path`` file. For ``addr`` type, you can specify the start and end address of the range (open-ended interval) to ``addr_start`` and ``addr_end`` files, respectively. For ``hugepage_size`` type, you can specify the minimum and maximum size of the range (closed interval) to ``min`` and ``max`` files, respectively. For ``target`` type, you can specify the index of the target between the list of the DAMON context's monitoring targets list to ``target_idx`` file.h](hFor }(hjhhhNhNubj_)}(h ``memcg``h]hmemcg}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh type, you can specify the memory cgroup of the interest by writing the path of the memory cgroup from the cgroups mount point to }(hjhhhNhNubj_)}(h``memcg_path``h]h memcg_path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file. For }(hjhhhNhNubj_)}(h``addr``h]haddr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhW type, you can specify the start and end address of the range (open-ended interval) to }(hjhhhNhNubj_)}(h``addr_start``h]h addr_start}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h ``addr_end``h]haddr_end}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh files, respectively. For }(hjhhhNhNubj_)}(h``hugepage_size``h]h hugepage_size}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhV type, you can specify the minimum and maximum size of the range (closed interval) to }(hjhhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }hjsbj_)}(h``max``h]hmax}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh files, respectively. For }(hjhhhNhNubj_)}(h ``target``h]htarget}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubht type, you can specify the index of the target between the list of the DAMON context’s monitoring targets list to }(hjhhhNhNubj_)}(h``target_idx``h]h target_idx}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hXYou can write ``Y`` or ``N`` to ``matching`` file to specify whether the filter is for memory that matches the ``type``. You can write ``Y`` or ``N`` to ``allow`` file to specify if applying the action to the memory that satisfies the ``type`` and ``matching`` should be allowed or not.h](hYou can write }(hjIhhhNhNubj_)}(h``Y``h]hY}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh or }(hjIhhhNhNubj_)}(h``N``h]hN}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh to }(hjIhhhNhNubj_)}(h ``matching``h]hmatching}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubhC file to specify whether the filter is for memory that matches the }(hjIhhhNhNubj_)}(h``type``h]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh. You can write }(hjIhhhNhNubj_)}(h``Y``h]hY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh or }hjIsbj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh to }(hjIhhhNhNubj_)}(h ``allow``h]hallow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubhI file to specify if applying the action to the memory that satisfies the }(hjIhhhNhNubj_)}(h``type``h]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh and }(hjIhhhNhNubj_)}(h ``matching``h]hmatching}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjIubh should be allowed or not.}(hjIhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubh)}(hFor example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except ``/having_care_already``.::h](hsFor example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except }(hjhhhNhNubj_)}(h``/having_care_already``h]h/having_care_already}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh.:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubj)}(hX(# cd ops_filters/0/ # echo 2 > nr_filters # # disallow anonymous pages echo anon > 0/type echo Y > 0/matching echo N > 0/allow # # further filter out all cgroups except one at '/having_care_already' echo memcg > 1/type echo /having_care_already > 1/memcg_path echo Y > 1/matching echo N > 1/allowh]hX(# cd ops_filters/0/ # echo 2 > nr_filters # # disallow anonymous pages echo anon > 0/type echo Y > 0/matching echo N > 0/allow # # further filter out all cgroups except one at '/having_care_already' echo memcg > 1/type echo /having_care_already > 1/memcg_path echo Y > 1/matching echo N > 1/allow}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj<hhubh)}(hRefer to the :ref:`DAMOS filters design documentation ` for more details including how multiple filters of different ``allow`` works, when each of the filters are supported, and differences on stats.h](h Refer to the }(hj'hhhNhNubh)}(hF:ref:`DAMOS filters design documentation `h]jq)}(hj1h]h"DAMOS filters design documentation}(hj3hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj/ubah}(h]h ]h"]h$]h&]refdocj refdomainj=reftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhj'ubh> for more details including how multiple filters of different }(hj'hhhNhNubj_)}(h ``allow``h]hallow}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj'ubhI works, when each of the filters are supported, and differences on stats.}(hj'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj<hhubj)}(h.. _sysfs_schemes_stats:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-statsuh1jhMhj<hhhhubeh}(h](schemes-n-core-ops-filtersj0eh ]h"](!schemes//{core_,ops_,}filters/ sysfs_filterseh$]h&]uh1hhjEhhhhhMj}j|j&sj}j0j&subh)}(hhh](h)}(hschemes//stats/h]hschemes//stats/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hDAMON counts statistics for each scheme. This statistics can be used for online analysis or tuning of the schemes. Refer to :ref:`design doc ` for more details about the stats.h](h~DAMON counts statistics for each scheme. This statistics can be used for online analysis or tuning of the schemes. Refer to }(hjhhhNhNubh)}(h+:ref:`design doc `h]jq)}(hjh]h design doc}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_statuh1hhhhMhjubh" for more details about the stats.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXThe statistics can be retrieved by reading the files under ``stats`` directory (``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, ``sz_ops_filter_passed``, and ``qt_exceeds``), respectively. The files are not updated in real time, so you should ask DAMON sysfs interface to update the content of the files for the stats by writing a special keyword, ``update_schemes_stats`` to the relevant ``kdamonds//state`` file.h](h;The statistics can be retrieved by reading the files under }(hjhhhNhNubj_)}(h ``stats``h]hstats}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory (}(hjhhhNhNubj_)}(h ``nr_tried``h]hnr_tried}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``sz_tried``h]hsz_tried}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``nr_applied``h]h nr_applied}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``sz_applied``h]h sz_applied}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``sz_ops_filter_passed``h]hsz_ops_filter_passed}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``qt_exceeds``h]h qt_exceeds}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh), respectively. The files are not updated in real time, so you should ask DAMON sysfs interface to update the content of the files for the stats by writing a special keyword, }(hjhhhNhNubj_)}(h``update_schemes_stats``h]hupdate_schemes_stats}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to the relevant }(hjhhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h .. _sysfs_schemes_tried_regions:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-tried-regionsuh1jhMhjhhhhubeh}(h](schemes-n-statsjueh ]h"](schemes//stats/sysfs_schemes_statseh$]h&]uh1hhjEhhhhhMj}j jksj}jujksubh)}(hhh](h)}(hschemes//tried_regions/h]hschemes//tried_regions/}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(h7This directory initially has one file, ``total_bytes``.h](h'This directory initially has one file, }(hj hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXWhen a special keyword, ``update_schemes_tried_regions``, is written to the relevant ``kdamonds//state`` file, DAMON updates the ``total_bytes`` file so that reading it returns the total size of the scheme tried regions, and creates directories named integer starting from ``0`` under this directory. Each directory contains files exposing detailed information about each of the memory region that the corresponding scheme's ``action`` has tried to be applied under this directory, during next :ref:`apply interval ` of the corresponding scheme. The information includes address range, ``nr_accesses``, and ``age`` of the region.h](hWhen a special keyword, }(hj hhhNhNubj_)}(h ``update_schemes_tried_regions``h]hupdate_schemes_tried_regions}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, is written to the relevant }(hj hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file, DAMON updates the }(hj hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file so that reading it returns the total size of the scheme tried regions, and creates directories named integer starting from }(hj hhhNhNubj_)}(h``0``h]h0}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh under this directory. Each directory contains files exposing detailed information about each of the memory region that the corresponding scheme’s }(hj hhhNhNubj_)}(h ``action``h]haction}(hj !hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh; has tried to be applied under this directory, during next }(hj hhhNhNubh)}(h*:ref:`apply interval `h]jq)}(hj!h]happly interval}(hj!!hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj!ubah}(h]h ]h"]h$]h&]refdocj refdomainj+!reftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhMhj ubhG of the corresponding scheme. The information includes address range, }(hj hhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hjA!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, and }(hj hhhNhNubj_)}(h``age``h]hage}(hjS!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh of the region.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hWriting ``update_schemes_tried_bytes`` to the relevant ``kdamonds//state`` file will only update the ``total_bytes`` file, and will not create the subdirectories.h](hWriting }(hjk!hhhNhNubj_)}(h``update_schemes_tried_bytes``h]hupdate_schemes_tried_bytes}(hjs!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjk!ubh to the relevant }(hjk!hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjk!ubh file will only update the }(hjk!hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjk!ubh. file, and will not create the subdirectories.}(hjk!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hThe directories will be removed when another special keyword, ``clear_schemes_tried_regions``, is written to the relevant ``kdamonds//state`` file.h](h>The directories will be removed when another special keyword, }(hj!hhhNhNubj_)}(h``clear_schemes_tried_regions``h]hclear_schemes_tried_regions}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj!ubh, is written to the relevant }(hj!hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj!ubh file.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj hhubh)}(hX7The expected usage of this directory is investigations of schemes' behaviors, and query-like efficient data access monitoring results retrievals. For the latter use case, in particular, users can set the ``action`` as ``stat`` and set the ``access pattern`` as their interested pattern that they want to query.h](hThe expected usage of this directory is investigations of schemes’ behaviors, and query-like efficient data access monitoring results retrievals. For the latter use case, in particular, users can set the }(hj!hhhNhNubj_)}(h ``action``h]haction}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj!ubh as }(hj!hhhNhNubj_)}(h``stat``h]hstat}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj!ubh and set the }(hj!hhhNhNubj_)}(h``access pattern``h]haccess pattern}(hj "hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj!ubh5 as their interested pattern that they want to query.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(h.. _sysfs_schemes_tried_region:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-tried-regionuh1jhMhj hhhhubeh}(h](schemes-n-tried-regionsj~ eh ]h"](schemes//tried_regions/sysfs_schemes_tried_regionseh$]h&]uh1hhjEhhhhhMj}j6"jt sj}j~ jt subh)}(hhh](h)}(htried_regions//h]htried_regions//}(hj>"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj;"hhhhhMubh)}(hX In each region directory, you will find five files (``start``, ``end``, ``nr_accesses``, ``age``, and ``sz_filter_passed``). Reading the files will show the properties of the region that corresponding DAMON-based operation scheme ``action`` has tried to be applied.h](h4In each region directory, you will find five files (}(hjL"hhhNhNubj_)}(h ``start``h]hstart}(hjT"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubh, }(hjL"hhhNhNubj_)}(h``end``h]hend}(hjf"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubh, }(hjL"hhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hjx"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubh, }hjL"sbj_)}(h``age``h]hage}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubh, and }(hjL"hhhNhNubj_)}(h``sz_filter_passed``h]hsz_filter_passed}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubhm). Reading the files will show the properties of the region that corresponding DAMON-based operation scheme }(hjL"hhhNhNubj_)}(h ``action``h]haction}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL"ubh has tried to be applied.}(hjL"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj;"hhubh)}(hhh](h)}(hExampleh]hExample}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"hhhhhM ubh)}(hX[Below commands applies a scheme saying "If a memory region of size in [4KiB, 8KiB] is showing accesses per aggregate interval in [0, 5] for aggregate interval in [10, 20], page out the region. For the paging out, use only up to 10ms per second, and also don't page out more than 1GiB per second. Under the limitation, page out memory regions having longer age first. Also, check the free memory rate of the system every 5 seconds, start the monitoring and paging out when the free memory rate becomes lower than 50%, but stop it if the free memory rate becomes larger than 60%, or lower than 30%". ::h]hX^Below commands applies a scheme saying “If a memory region of size in [4KiB, 8KiB] is showing accesses per aggregate interval in [0, 5] for aggregate interval in [10, 20], page out the region. For the paging out, use only up to 10ms per second, and also don’t page out more than 1GiB per second. Under the limitation, page out memory regions having longer age first. Also, check the free memory rate of the system every 5 seconds, start the monitoring and paging out when the free memory rate becomes lower than 50%, but stop it if the free memory rate becomes larger than 60%, or lower than 30%”.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hj"hhubj)}(hX7# cd /kernel/mm/damon/admin # # populate directories # echo 1 > kdamonds/nr_kdamonds; echo 1 > kdamonds/0/contexts/nr_contexts; # echo 1 > kdamonds/0/contexts/0/schemes/nr_schemes # cd kdamonds/0/contexts/0/schemes/0 # # set the basic access pattern and the action # echo 4096 > access_pattern/sz/min # echo 8192 > access_pattern/sz/max # echo 0 > access_pattern/nr_accesses/min # echo 5 > access_pattern/nr_accesses/max # echo 10 > access_pattern/age/min # echo 20 > access_pattern/age/max # echo pageout > action # # set quotas # echo 10 > quotas/ms # echo $((1024*1024*1024)) > quotas/bytes # echo 1000 > quotas/reset_interval_ms # # set watermark # echo free_mem_rate > watermarks/metric # echo 5000000 > watermarks/interval_us # echo 600 > watermarks/high # echo 500 > watermarks/mid # echo 300 > watermarks/lowh]hX7# cd /kernel/mm/damon/admin # # populate directories # echo 1 > kdamonds/nr_kdamonds; echo 1 > kdamonds/0/contexts/nr_contexts; # echo 1 > kdamonds/0/contexts/0/schemes/nr_schemes # cd kdamonds/0/contexts/0/schemes/0 # # set the basic access pattern and the action # echo 4096 > access_pattern/sz/min # echo 8192 > access_pattern/sz/max # echo 0 > access_pattern/nr_accesses/min # echo 5 > access_pattern/nr_accesses/max # echo 10 > access_pattern/age/min # echo 20 > access_pattern/age/max # echo pageout > action # # set quotas # echo 10 > quotas/ms # echo $((1024*1024*1024)) > quotas/bytes # echo 1000 > quotas/reset_interval_ms # # set watermark # echo free_mem_rate > watermarks/metric # echo 5000000 > watermarks/interval_us # echo 600 > watermarks/high # echo 500 > watermarks/mid # echo 300 > watermarks/low}hj"sbah}(h]h ]h"]h$]h&]hhuh1jhhhM+hj"hhubh)}(hPlease note that it's highly recommended to use user space tools like `damo `_ rather than manually reading and writing the files as above. Above is only for an example.h](hHPlease note that it’s highly recommended to use user space tools like }(hj"hhhNhNubh)}(h+`damo `_h]hdamo}(hj"hhhNhNubah}(h]h ]h"]h$]h&]namedamoj!https://github.com/damonitor/damouh1hhj"ubj)}(h$ h]h}(h]damoah ]h"]damoah$]h&]refurij #uh1jjKhj"ubh\ rather than manually reading and writing the files as above. Above is only for an example.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMChj"hhubj)}(h.. _tracepoint:h]h}(h]h ]h"]h$]h&]jC tracepointuh1jhMGhj"hhhhubeh}(h]exampleah ]h"]exampleah$]h&]uh1hhj;"hhhhhM ubeh}(h](tried-regions-nj/"eh ]h"](tried_regions//sysfs_schemes_tried_regioneh$]h&]uh1hhjEhhhhhMj}j<#j%"sj}j/"j%"subeh}(h](jDid1eh ]h"](sysfs interfacesysfs_interfaceeh$]h&]uh1hhhhhhhhK!j}jG#j9sj}jDj9subh)}(hhh](h)}(h"Tracepoints for Monitoring Resultsh]h"Tracepoints for Monitoring Results}(hjO#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjL#hhhhhMJubh)}(hX&Users can get the monitoring results via the :ref:`tried_regions `. The interface is useful for getting a snapshot, but it could be inefficient for fully recording all the monitoring results. For the purpose, two trace points, namely ``damon:damon_aggregated`` and ``damon:damos_before_apply``, are provided. ``damon:damon_aggregated`` provides the whole monitoring results, while ``damon:damos_before_apply`` provides the monitoring results for regions that each DAMON-based Operation Scheme (:ref:`DAMOS `) is gonna be applied. Hence, ``damon:damos_before_apply`` is more useful for recording internal behavior of DAMOS, or DAMOS target access :ref:`pattern ` based query-like efficient monitoring results recording.h](h-Users can get the monitoring results via the }(hj]#hhhNhNubh)}(h2:ref:`tried_regions `h]jq)}(hjg#h]h tried_regions}(hji#hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphje#ubah}(h]h ]h"]h$]h&]refdocj refdomainjs#reftyperef refexplicitrefwarnjsysfs_schemes_tried_regionsuh1hhhhMLhj]#ubh. The interface is useful for getting a snapshot, but it could be inefficient for fully recording all the monitoring results. For the purpose, two trace points, namely }(hj]#hhhNhNubj_)}(h``damon:damon_aggregated``h]hdamon:damon_aggregated}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj]#ubh and }(hj]#hhhNhNubj_)}(h``damon:damos_before_apply``h]hdamon:damos_before_apply}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj]#ubh, are provided. }(hj]#hhhNhNubj_)}(h``damon:damon_aggregated``h]hdamon:damon_aggregated}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj]#ubh. provides the whole monitoring results, while }(hj]#hhhNhNubj_)}(h``damon:damos_before_apply``h]hdamon:damos_before_apply}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj]#ubhU provides the monitoring results for regions that each DAMON-based Operation Scheme (}(hj]#hhhNhNubh)}(h!:ref:`DAMOS `h]jq)}(hj#h]hDAMOS}(hj#hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj#ubah}(h]h ]h"]h$]h&]refdocj refdomainj#reftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhMLhj]#ubh) is gonna be applied. Hence, }(hj]#hhhNhNubj_)}(h``damon:damos_before_apply``h]hdamon:damos_before_apply}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj]#ubhQ is more useful for recording internal behavior of DAMOS, or DAMOS target access }(hj]#hhhNhNubh)}(h2:ref:`pattern `h]jq)}(hj $h]hpattern}(hj $hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj$ubah}(h]h ]h"]h$]h&]refdocj refdomainj$reftyperef refexplicitrefwarnj!damon_design_damos_access_patternuh1hhhhMLhj]#ubh9 based query-like efficient monitoring results recording.}(hj]#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjL#hhubh)}(hWhile the monitoring is turned on, you could record the tracepoint events and show results using tracepoint supporting tools like ``perf``. For example::h](hWhile the monitoring is turned on, you could record the tracepoint events and show results using tracepoint supporting tools like }(hj1$hhhNhNubj_)}(h``perf``h]hperf}(hj9$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj1$ubh. For example:}(hj1$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMYhjL#hhubj)}(hX# echo on > kdamonds/0/state # perf record -e damon:damon_aggregated & # sleep 5 # kill 9 $(pidof perf) # echo off > kdamonds/0/state # perf script kdamond.0 46568 [027] 79357.842179: damon:damon_aggregated: target_id=0 nr_regions=11 122509119488-135708762112: 0 864 [...]h]hX# echo on > kdamonds/0/state # perf record -e damon:damon_aggregated & # sleep 5 # kill 9 $(pidof perf) # echo off > kdamonds/0/state # perf script kdamond.0 46568 [027] 79357.842179: damon:damon_aggregated: target_id=0 nr_regions=11 122509119488-135708762112: 0 864 [...]}hjQ$sbah}(h]h ]h"]h$]h&]hhuh1jhhhM\hjL#hhubh)}(hXEach line of the perf script output represents each monitoring region. The first five fields are as usual other tracepoint outputs. The sixth field (``target_id=X``) shows the ide of the monitoring target of the region. The seventh field (``nr_regions=X``) shows the total number of monitoring regions for the target. The eighth field (``X-Y:``) shows the start (``X``) and end (``Y``) addresses of the region in bytes. The ninth field (``X``) shows the ``nr_accesses`` of the region (refer to :ref:`design ` for more details of the counter). Finally the tenth field (``X``) shows the ``age`` of the region (refer to :ref:`design ` for more details of the counter).h](hEach line of the perf script output represents each monitoring region. The first five fields are as usual other tracepoint outputs. The sixth field (}(hj_$hhhNhNubj_)}(h``target_id=X``h]h target_id=X}(hjg$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubhL) shows the ide of the monitoring target of the region. The seventh field (}(hj_$hhhNhNubj_)}(h``nr_regions=X``h]h nr_regions=X}(hjy$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubhR) shows the total number of monitoring regions for the target. The eighth field (}(hj_$hhhNhNubj_)}(h``X-Y:``h]hX-Y:}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh) shows the start (}(hj_$hhhNhNubj_)}(h``X``h]hX}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh ) and end (}(hj_$hhhNhNubj_)}(h``Y``h]hY}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh6) addresses of the region in bytes. The ninth field (}(hj_$hhhNhNubj_)}(h``X``h]hX}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh ) shows the }(hj_$hhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh of the region (refer to }(hj_$hhhNhNubh)}(h2:ref:`design `h]jq)}(hj$h]hdesign}(hj$1hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj$ubah}(h]h ]h"]h$]h&]refdocj refdomainj$reftyperef refexplicitrefwarnj"damon_design_region_based_samplinguh1hhhhMehj_$ubh= for more details of the counter). Finally the tenth field (}(hj_$hhhNhNubj_)}(h``X``h]hX}(hj %hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh ) shows the }(hj_$hhhNhNubj_)}(h``age``h]hage}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj_$ubh of the region (refer to }(hj_$hhhNhNubh)}(h):ref:`design `h]jq)}(hj/%h]hdesign}(hj1%hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj-%ubah}(h]h ]h"]h$]h&]refdocj refdomainj;%reftyperef refexplicitrefwarnjdamon_design_age_trackinguh1hhhhMehj_$ubh" for more details of the counter).}(hj_$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMehjL#hhubh)}(hhIf the event was ``damon:damos_beofre_apply``, the ``perf script`` output would be somewhat like below::h](hIf the event was }(hjW%hhhNhNubj_)}(h``damon:damos_beofre_apply``h]hdamon:damos_beofre_apply}(hj_%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjW%ubh, the }(hjW%hhhNhNubj_)}(h``perf script``h]h perf script}(hjq%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjW%ubh% output would be somewhat like below:}(hjW%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMqhjL#hhubj)}(hkdamond.0 47293 [000] 80801.060214: damon:damos_before_apply: ctx_idx=0 scheme_idx=0 target_idx=0 nr_regions=11 121932607488-135128711168: 0 136 [...]h]hkdamond.0 47293 [000] 80801.060214: damon:damos_before_apply: ctx_idx=0 scheme_idx=0 target_idx=0 nr_regions=11 121932607488-135128711168: 0 136 [...]}hj%sbah}(h]h ]h"]h$]h&]hhuh1jhhhMthjL#hhubh)}(hXEach line of the output represents each monitoring region that each DAMON-based Operation Scheme was about to be applied at the traced time. The first five fields are as usual. It shows the index of the DAMON context (``ctx_idx=X``) of the scheme in the list of the contexts of the context's kdamond, the index of the scheme (``scheme_idx=X``) in the list of the schemes of the context, in addition to the output of ``damon_aggregated`` tracepoint.h](hEach line of the output represents each monitoring region that each DAMON-based Operation Scheme was about to be applied at the traced time. The first five fields are as usual. It shows the index of the DAMON context (}(hj%hhhNhNubj_)}(h ``ctx_idx=X``h]h ctx_idx=X}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubha) of the scheme in the list of the contexts of the context’s kdamond, the index of the scheme (}(hj%hhhNhNubj_)}(h``scheme_idx=X``h]h scheme_idx=X}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubhJ) in the list of the schemes of the context, in addition to the output of }(hj%hhhNhNubj_)}(h``damon_aggregated``h]hdamon_aggregated}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh tracepoint.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMwhjL#hhubeh}(h]("tracepoints-for-monitoring-resultsj-#eh ]h"]("tracepoints for monitoring results tracepointeh$]h&]uh1hhhhhhhhMJj}j%j##sj}j-#j##subeh}(h]detailed-usagesah ]h"]detailed usagesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj&error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(jD]j9aj]jaj]jaj]jaj ]j~ ajM ]jC ajv ]jl aj ]j aj]j aj]jaj.]j$aj!]jaj]jaj]juaj|]jraj]jaj]jaj]jaj0]j&aju]jkaj~ ]jt aj/"]j%"aj-#]j##aunameids}(j%j%jjj>j;jjjG#jDjF#jC#jjjjjjjjjjj jj j jT j jS jP j} jM j| jy j jv j j jj jjjjjjj5jj4j1j(j.j'j$jj!jjjjjjjjjjjj|jjjjjjjjjjj7jj6j3j|j0j{jxj juj j j6"j~ j5"j2"j<#j/"j;#j8#j3#j0#j#j#j%j-#j%j%u nametypes}(j%jj>jjG#jF#jjjjjj j jT jS j} j| j j jjjjj5j4j(j'jjjjjjjjjjjjj7j6j|j{j j j6"j5"j<#j;#j3#j#j%j%uh}(j%hjjj;j5jjjDjEjC#jEjjjjjjjjjjjjj jj j jP j jM jY jy jY jv j j j j j jj jj jj jjj1jj.j:j$j:j!j-jj-jjjjjjjjj|jjjjjjjjjjjjjj3jj0j<jxj<jujj jj~ j j2"j j/"j;"j8#j;"j0#j"j#j #j-#jL#j%jL#u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}j&KsRparse_messages]transform_messages](hsystem_message)}(hhh]h)}(hhh]h5Hyperlink target "sysfs-interface" is not referenced.}hj&sbah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j&ubj&)}(hhh]h)}(hhh]h0Hyperlink target "sysfs-root" is not referenced.}hj&sbah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej&sourcehlineK`uh1j&ubj&)}(hhh]h)}(hhh]h4Hyperlink target "sysfs-kdamonds" is not referenced.}hj&sbah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej&sourcehlineKjuh1j&ubj&)}(hhh]h)}(hhh]h3Hyperlink target "sysfs-kdamond" is not referenced.}hj&sbah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej&sourcehlineKwuh1j&ubj&)}(hhh]h)}(hhh]h4Hyperlink target "sysfs-contexts" is not referenced.}hj&sbah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej&sourcehlineKuh1j&ubj&)}(hhh]h)}(hhh]h3Hyperlink target "sysfs-context" is not referenced.}hj'sbah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej&sourcehlineKuh1j&ubj&)}(hhh]h)}(hhh]h