Psphinx.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)}(hX7 :ref:`/sys/kernel/mm/damon `/admin │ :ref:`kdamonds `/nr_kdamonds │ │ :ref:`0 `/state,pid,refresh_ms │ │ │ :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,nid │ │ │ │ │ │ │ :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:`dests `/nr_dests │ │ │ │ │ │ │ │ 0/id,weight │ │ │ │ │ │ │ :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,refresh_ms │ │ │ }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:hjubhy/nr_goals │ │ │ │ │ │ │ │ │ 0/target_metric,target_value,current_value,nid │ │ │ │ │ │ │ }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:`dests `h]jq)}(hjCh]hdests}(hjEhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjAubah}(h]h ]h"]h$]h&]refdocj refdomainjOreftyperef refexplicitrefwarnjdamon_sysfs_destsuh1hhhhK:hjubhR/nr_dests │ │ │ │ │ │ │ │ 0/id,weight │ │ │ │ │ │ │ }hjsbh)}(h":ref:`stats `h]jq)}(hjgh]hstats}(hjihhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjeubah}(h]h ]h"]h$]h&]refdocj refdomainjsreftyperef 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)}(hjh]h tried_regions}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef 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&]uh1hhhhKghjhhubj)}(h.. _sysfs_kdamonds:h]h}(h]h ]h"]h$]h&]jCsysfs-kdamondsuh1jhKlhjhhhhubeh}(h](rootjeh ]h"](root sysfs_rooteh$]h&]uh1hhjEhhhhhKeexpect_referenced_by_name}jjsexpect_referenced_by_id}jjsubh)}(hhh](h)}(h kdamonds/h]h kdamonds/}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj!hhhhhKoubh)}(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 }(hj2hhhNhNubj_)}(h ``admin``h]hadmin}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh directory, one directory, }(hj2hhhNhNubj_)}(h ``kdamonds``h]hkdamonds}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh9, which has files for controlling the kdamonds (refer to }(hj2hhhNhNubh)}(h@:ref:`design `h]jq)}(hj`h]hdesign}(hjbhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj^ubah}(h]h ]h"]h$]h&]refdocj refdomainjlreftyperef refexplicitrefwarnj0damon_design_execution_model_and_data_structuresuh1hhhhKqhj2ubhP for more details) exists. In the beginning, this directory has only one file, }(hj2hhhNhNubj_)}(h``nr_kdamonds``h]h nr_kdamonds}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh. Writing a number (}(hj2hhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh<) to the file creates the number of child directories named }(hj2hhhNhNubj_)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh to }(hj2hhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj2ubh*. Each directory represents each kdamond.}(hj2hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKqhj!hhubj)}(h.. _sysfs_kdamond:h]h}(h]h ]h"]h$]h&]jC sysfs-kdamonduh1jhKyhj!hhhhubeh}(h](kdamondsjeh ]h"]( kdamonds/sysfs_kdamondseh$]h&]uh1hhjEhhhhhKoj}jj sj}jj subh)}(hhh](h)}(h kdamonds//h]h kdamonds//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK|ubh)}(hvIn each kdamond directory, three files (``state``, ``pid`` and ``refresh_ms``) and one directory (``contexts``) exist.h](h(In each kdamond directory, three files (}(hjhhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``pid``h]hpid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``refresh_ms``h]h refresh_ms}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and one directory (}(hjhhhNhNubj_)}(h ``contexts``h]hcontexts}(hj5hhhNhNubah}(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 }(hjMhhhNhNubj_)}(h ``state``h]hstate}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjMubh returns }(hjMhhhNhNubj_)}(h``on``h]hon}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjMubh) if the kdamond is currently running, or }(hjMhhhNhNubj_)}(h``off``h]hoff}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjMubh if it is not running.}(hjMhhhNhNubeh}(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 }(hjhhhNhNubj_)}(h ``state``h]hstate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(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&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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&]uh1hhjhhhhhNubh)}(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&]uh1hhjhhhhhNubh)}(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}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh: Update the contents of }(hj:hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh and }(hj:hhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh3 files of the kdamond with the auto-tuning applied }(hj:hhhNhNubj_)}(h``sampling interval``h]hsampling interval}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh and }(hj:hhhNhNubj_)}(h``aggregation interval``h]haggregation interval}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj:ubh! for the files. Please refer to }(hj:hhhNhNubh)}(hK:ref:`intervals_goal section `h]jq)}(hjh]hintervals_goal section}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj+damon_usage_sysfs_monitoring_intervals_goaluh1hhhhKhj:ubh for more details.}(hj:hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj6ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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&]uh1hhjhhhhhNubh)}(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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh: Update the contents of stats files for each DAMON-based operation scheme of the kdamond. For details of the stats, please refer to }(hj hhhNhNubh)}(h*:ref:`stats section `h]jq)}(hj. h]h stats section}(hj0 hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj, ubah}(h]h ]h"]h$]h&]refdocj refdomainj: reftyperef refexplicitrefwarnjsysfs_schemes_statsuh1hhhhKhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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}(hjd 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)}(hjx h]htried_regions section}(hjz hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjv ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjsysfs_schemes_tried_regionsuh1hhhhKhj` ubh.}(hj` hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj\ ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh: Update only }(hj hhhNhNubj_)}(h!``.../tried_regions/total_bytes``h]h.../tried_regions/total_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh files.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubh)}(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&]uh1hhjhhhhhNubh)}(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)}(hj2 h]hquotas directory}(hj4 hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj0 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&]uh1hhjhhhhhNubeh}(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 }(hjf hhhNhNubj_)}(h``on``h]hon}(hjn hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjf ubh , reading }(hjf hhhNhNubj_)}(h``pid``h]hpid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjf ubh% shows the pid of the kdamond thread.}(hjf hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXUsers can ask the kernel to periodically update files showing auto-tuned parameters and DAMOS stats instead of manually writing ``update_tuned_intervals`` like keywords to ``state`` file. For this, users should write the desired update time interval in milliseconds to ``refresh_ms`` file. If the interval is zero, the periodic update is disabled. Reading the file shows currently set time interval.h](hUsers can ask the kernel to periodically update files showing auto-tuned parameters and DAMOS stats instead of manually writing }(hj hhhNhNubj_)}(h``update_tuned_intervals``h]hupdate_tuned_intervals}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh like keywords to }(hj hhhNhNubj_)}(h ``state``h]hstate}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhY file. For this, users should write the desired update time interval in milliseconds to }(hj hhhNhNubj_)}(h``refresh_ms``h]h refresh_ms}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhv file. If the interval is zero, the periodic update is disabled. Reading the file shows currently set time interval.}(hj 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubha directory contains files for controlling the monitoring contexts that this kdamond will execute.}(hj 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&]uh1hhjEhhhhhK|j}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}(hj9 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}(hjK 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)}(hjq h]hdesign}(hjs hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjo 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}j j sj}j j subh)}(hhh](h)}(h contexts//h]h contexts//}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj 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 (}(hj hhhNhNubj_)}(h``avail_operations``h]havail_operations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }(hj hhhNhNubj_)}(h``operations``h]h operations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh) and three directories (}(hj hhhNhNubj_)}(h``monitoring_attrs``h]hmonitoring_attrs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, }(hj hhhNhNubj_)}(h ``targets``h]htargets}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh, and }(hj hhhNhNubj_)}(h ``schemes``h]hschemes}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh) exist.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj 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 }(hjL hhhNhNubh)}(hG:ref:`monitoring operations `h]jq)}(hjV h]hmonitoring operations}(hjX hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjT ubah}(h]h ]h"]h$]h&]refdocj refdomainjb reftyperef refexplicitrefwarnj(damon_design_configurable_operations_setuh1hhhhKhjL 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 }(hjL hhhNhNubj_)}(h``avail_operations``h]havail_operations}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL ubhw file. Based on the kernel configuration, the file will list different available operation sets. Please refer to the }(hjL 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_setuh1hhhhKhjL ubhK for the list of all available operation sets and their brief explanations.}(hjL hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file and reading from the }(hj hhhNhNubj_)}(h``operations``h]h operations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(h.. _sysfs_monitoring_attrs:h]h}(h]h ]h"]h$]h&]jCsysfs-monitoring-attrsuh1jhKhj hhhhubeh}(h]( contexts-nj eh ]h"]( contexts// sysfs_contexteh$]h&]uh1hhjEhhhhhKj}j j sj}j j 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}(hj9 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 }(hjQ hhhNhNubj_)}(h ``intervals``h]h intervals}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjQ ubh9 directory, three files for DAMON’s sampling interval (}(hjQ hhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjQ ubh), aggregation interval (}(hjQ hhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hj} hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjQ ubh), and update interval (}(hjQ hhhNhNubj_)}(h ``update_us``h]h update_us}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjQ ubhc) exist. You can set and get the values in micro-seconds by writing to and reading from the files.}(hjQ 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}(hj 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }(hj hhhNhNubj_)}(h``max``h]hmax}(hj 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 (}(hj hhhNhNubh)}(h:doc:`/mm/damon/design`h]jq)}(hj h]h/mm/damon/design}(hj hhhNhNubah}(h]h ](j|stdstd-doceh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypedoc refexplicitrefwarnj/mm/damon/designuh1hhhhKhj ubh).}(hj 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-attrsj eh ]h"](contexts//monitoring_attrs/sysfs_monitoring_attrseh$]h&]uh1hhjEhhhhhKj}j.j sj}j j subh)}(hhh](h)}(h7contexts//monitoring_attrs/intervals/intervals_goal/h]h7contexts//monitoring_attrs/intervals/intervals_goal/}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hhhhhKubh)}(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 }(hjDhhhNhNubj_)}(h ``intervals``h]h intervals}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh2 directory, one directory for automated tuning of }(hjDhhhNhNubj_)}(h ``sample_us``h]h sample_us}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh and }(hjDhhhNhNubj_)}(h ``aggr_us``h]haggr_us}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh , namely }(hjDhhhNhNubj_)}(h``intervals_goal``h]hintervals_goal}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh\ directory also exists. Under the directory, four files for the auto-tuning control, namely }(hjDhhhNhNubj_)}(h ``access_bp``h]h access_bp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh, }(hjDhhhNhNubj_)}(h ``aggrs``h]haggrs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh, }hjDsbj_)}(h``min_sample_us``h]h min_sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh and }hjDsbj_)}(h``max_sample_us``h]h max_sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh exist. Please refer to the }(hjDhhhNhNubh)}(hT:ref:`design document of the feature `h]jq)}(hjh]hdesign document of the feature}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj,damon_design_monitoring_intervals_autotuninguh1hhhhKhjDubhU for the internal of the tuning mechanism. Reading and writing the four files under }(hjDhhhNhNubj_)}(h``intervals_goal``h]hintervals_goal}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh 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 }(hjDhhhNhNubj_)}(h ``sample_us``h]h sample_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh and }hjDsbj_)}(h ``aggr_us``h]haggr_us}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubhO. The tuning-applied current values of the two intervals can be read from the }(hjDhhhNhNubj_)}(h ``sample_us``h]h sample_us}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh and }hjDsbj_)}(h ``aggr_us``h]haggr_us}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh files after writing }(hjDhhhNhNubj_)}(h``update_tuned_intervals``h]hupdate_tuned_intervals}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh to the }(hjDhhhNhNubj_)}(h ``state``h]hstate}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjDubh file.}(hjDhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj3hhubj)}(h.. _sysfs_targets:h]h}(h]h ]h"]h$]h&]jC sysfs-targetsuh1jhKhj3hhhhubeh}(h](4contexts-n-monitoring-attrs-intervals-intervals-goalj'eh ]h"](7contexts//monitoring_attrs/intervals/intervals_goal/+damon_usage_sysfs_monitoring_intervals_goaleh$]h&]uh1hhjEhhhhhKj}jjsj}j'jsubh)}(hhh](h)}(hcontexts//targets/h]hcontexts//targets/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(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, }(hjhhhNhNubj_)}(h``nr_targets``h]h nr_targets}(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^hjubh4. Each directory represents each monitoring target.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h.. _sysfs_target:h]h}(h]h ]h"]h$]h&]jC sysfs-targetuh1jhMhjhhhhubeh}(h](contexts-n-targetsjeh ]h"](contexts//targets/ sysfs_targetseh$]h&]uh1hhjEhhhhhKj}jjsj}jjsubh)}(hhh](h)}(h targets//h]h targets//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hZIn each target directory, one file (``pid_target``) and one directory (``regions``) exist.h](h$In each target directory, one file (}(hj(hhhNhNubj_)}(h``pid_target``h]h pid_target}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj(ubh) and one directory (}(hj(hhhNhNubj_)}(h ``regions``h]hregions}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj(ubh) exist.}(hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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 }(hjZhhhNhNubj_)}(h ``vaddr``h]hvaddr}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjZubh to the }(hjZhhhNhNubj_)}(h``contexts//operations``h]hcontexts//operations}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjZubhr, each target should be a process. You can specify the process to DAMON by writing the pid of the process to the }(hjZhhhNhNubj_)}(h``pid_target``h]h pid_target}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjZubh file.}(hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjhhubj)}(h.. _sysfs_regions:h]h}(h]h ]h"]h$]h&]jC sysfs-regionsuh1jhMhjhhhhubeh}(h]( targets-nj eh ]h"]( targets// sysfs_targeteh$]h&]uh1hhjEhhhhhMj}jjsj}j jsubh)}(hhh](h)}(htargets//regionsh]htargets//regions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(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 }(hjhhhNhNubj_)}(h ``fvaddr``h]hfvaddr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh or }(hjhhhNhNubj_)}(h ``paddr``h]hpaddr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhi monitoring operations sets, users are required to set the monitoring target address ranges. In case of }(hjhhhNhNubj_)}(h ``vaddr``h]hvaddr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh operations set, it is not mandatory, but users can optionally set the initial monitoring region to specific address ranges. Please refer to the }(hjhhhNhNubh)}(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_constructionuh1hhhhMhjubh for more details.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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.}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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, }(hj;hhhNhNubj_)}(h``nr_regions``h]h nr_regions}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj;ubh. Writing a number (}(hj;hhhNhNubj_)}(h``N``h]hN}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj;ubh<) to the file creates the number of child directories named }(hj;hhhNhNubj_)}(h``0``h]h0}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj;ubh to }(hj;hhhNhNubj_)}(h``N-1``h]hN-1}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj;ubhC. Each directory represents each initial monitoring target region.}(hj;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _sysfs_region:h]h}(h]h ]h"]h$]h&]jC sysfs-regionuh1jhM!hjhhhhubeh}(h](targets-n-regionsjeh ]h"](targets//regions sysfs_regionseh$]h&]uh1hhjEhhhhhMj}jjsj}jjsubh)}(hhh](h)}(h regions//h]h regions//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM$ubh)}(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 (}(hjhhhNhNubj_)}(h ``start``h]hstart}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``end``h]hend}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh). 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.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM&hjhhubh)}(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. }(hjhhhNhNubj_)}(h``end``h]hend}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh of directory }(hjhhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh! should be equal or smaller than }(hjhhhNhNubj_)}(h ``start``h]hstart}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh of directory }hjsbj_)}(h``N+1``h]hN+1}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM*hjhhubj)}(h.. _sysfs_schemes:h]h}(h]h ]h"]h$]h&]jC sysfs-schemesuh1jhM-hjhhhhubeh}(h]( regions-njeh ]h"]( regions// sysfs_regioneh$]h&]uh1hhjEhhhhhM$j}jQjsj}jjsubh)}(hhh](h)}(hcontexts//schemes/h]hcontexts//schemes/}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjVhhhhhM0ubh)}(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 (}(hjghhhNhNubh)}(h!:ref:`DAMOS `h]jq)}(hjqh]hDAMOS}(hjshhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjoubah}(h]h ]h"]h$]h&]refdocj refdomainj}reftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhM2hjgubh`). Users can get and set the schemes by reading from and writing to files under this directory.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM2hjVhhubh)}(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}(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^hjubh?. Each directory represents each DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM6hjVhhubj)}(h.. _sysfs_scheme:h]h}(h]h ]h"]h$]h&]jC sysfs-schemeuh1jhM:hjVhhhhubeh}(h](contexts-n-schemesjJeh ]h"](contexts//schemes/ sysfs_schemeseh$]h&]uh1hhjEhhhhhM0j}jj@sj}jJj@subh)}(hhh](h)}(h schemes//h]h schemes//}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM=ubh)}(hXIn each scheme directory, eight directories (``access_pattern``, ``quotas``, ``watermarks``, ``core_filters``, ``ops_filters``, ``filters``, ``dests``, ``stats``, and ``tried_regions``) and three files (``action``, ``target_nid`` and ``apply_interval``) exist.h](h-In each scheme directory, eight directories (}(hjhhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``quotas``h]hquotas}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``watermarks``h]h watermarks}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``core_filters``h]h core_filters}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``ops_filters``h]h ops_filters}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h ``filters``h]hfilters}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h ``dests``h]hdests}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) and three files (}(hjhhhNhNubj_)}(h ``action``h]haction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``target_nid``h]h target_nid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``apply_interval``h]happly_interval}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM?hjhhubh)}(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 }(hjhhhNhNubj_)}(h ``action``h]haction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh0 file is for setting and getting the scheme’s }(hjhhhNhNubh)}(h):ref:`action `h]jq)}(hjh]haction}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj$reftyperef refexplicitrefwarnjdamon_design_damos_actionuh1hhhhMDhjubhq. The keywords that can be written to and read from the file and their meaning are same to those of the list on }(hjhhhNhNubh)}(h-:ref:`design doc `h]jq)}(hj<h]h design doc}(hj>hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj:ubah}(h]h ]h"]h$]h&]refdocj refdomainjHreftyperef refexplicitrefwarnjdamon_design_damos_actionuh1hhhhMDhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMDhjhhubh)}(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 }(hjdhhhNhNubj_)}(h``target_nid``h]h target_nid}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjdubhR file is for setting the migration target node, which is only meaningful when the }(hjdhhhNhNubj_)}(h ``action``h]haction}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjdubh is either }(hjdhhhNhNubj_)}(h``migrate_hot``h]h migrate_hot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjdubh or }(hjdhhhNhNubj_)}(h``migrate_cold``h]h migrate_cold}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjdubh.}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMIhjhhubh)}(hThe ``apply_interval_us`` file is for setting and getting the scheme's :ref:`apply_interval ` in microseconds.h](hThe }(hjhhhNhNubj_)}(h``apply_interval_us``h]happly_interval_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh0 file is for setting and getting the scheme’s }(hjhhhNhNubh)}(h*:ref:`apply_interval `h]jq)}(hjh]happly_interval}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damosuh1hhhhMMhjubh in microseconds.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMMhjhhubj)}(h.. _sysfs_access_pattern:h]h}(h]h ]h"]h$]h&]jCsysfs-access-patternuh1jhMPhjhhhhubeh}(h]( schemes-njeh ]h"]( schemes// sysfs_schemeeh$]h&]uh1hhjEhhhhhM=j}jjsj}jjsubh)}(hhh](h)}(hschemes//access_pattern/h]hschemes//access_pattern/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMSubh)}(hThe directory for the target access :ref:`pattern ` of the given DAMON-based operation scheme.h](h$The directory for the target access }(hj%hhhNhNubh)}(h2:ref:`pattern `h]jq)}(hj/h]hpattern}(hj1hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj-ubah}(h]h ]h"]h$]h&]refdocj refdomainj;reftyperef refexplicitrefwarnj!damon_design_damos_access_patternuh1hhhhMUhj%ubh+ of the given DAMON-based operation scheme.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMUhjhhubh)}(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 }(hjWhhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh directory, three directories (}(hjWhhhNhNubj_)}(h``sz``h]hsz}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh, }(hjWhhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh, and }(hjWhhhNhNubj_)}(h``age``h]hage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh) each having two files (}(hjWhhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh and }(hjWhhhNhNubj_)}(h``max``h]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubhi) exist. You can set and get the access pattern for the given scheme by writing to and reading from the }(hjWhhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh and }hjWsbj_)}(h``max``h]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh files under }(hjWhhhNhNubj_)}(h``sz``h]hsz}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh, }hjWsbj_)}(h``nr_accesses``h]h nr_accesses}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh, and }hjWsbj_)}(h``age``h]hage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh+ directories, respectively. Note that the }(hjWhhhNhNubj_)}(h``min``h]hmin}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh and the }(hjWhhhNhNubj_)}(h``max``h]hmax}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjWubh form a closed interval.}(hjWhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMXhjhhubj)}(h.. _sysfs_quotas:h]h}(h]h ]h"]h$]h&]jC sysfs-quotasuh1jhM_hjhhhhubeh}(h](schemes-n-access-patternjeh ]h"](schemes//access_pattern/sysfs_access_patterneh$]h&]uh1hhjEhhhhhMSj}j`jsj}jjsubh)}(hhh](h)}(hschemes//quotas/h]hschemes//quotas/}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjehhhhhMbubh)}(hjThe directory for the :ref:`quotas ` of the given DAMON-based operation scheme.h](hThe directory for the }(hjvhhhNhNubh)}(h):ref:`quotas `h]jq)}(hjh]hquotas}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj~ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_quotasuh1hhhhMdhjvubh+ of the given DAMON-based operation scheme.}(hjvhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMdhjehhubh)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory, four files (}(hjhhhNhNubj_)}(h``ms``h]hms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h ``bytes``h]hbytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``reset_interval_ms``h]hreset_interval_ms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``effective_bytes``h]heffective_bytes}(hjhhhNhNubah}(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&]uh1hhhhMghjehhubh)}(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 }(hj4hhhNhNubj_)}(h``time quota``h]h time quota}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh in milliseconds, }(hj4hhhNhNubj_)}(h``size quota``h]h size quota}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh in bytes, and }(hj4hhhNhNubj_)}(h``reset interval``h]hreset interval}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubhn in milliseconds by writing the values to the three files, respectively. Then, DAMON tries to use only up to }(hj4hhhNhNubj_)}(h``time quota``h]h time quota}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh milliseconds for applying the }(hj4hhhNhNubj_)}(h ``action``h]haction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh to memory regions of the }(hj4hhhNhNubj_)}(h``access_pattern``h]haccess_pattern}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh(, and to apply the action to only up to }(hj4hhhNhNubj_)}(h ``bytes``h]hbytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh$ bytes of memory regions within the }(hj4hhhNhNubj_)}(h``reset_interval_ms``h]hreset_interval_ms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh. Setting both }(hj4hhhNhNubj_)}(h``ms``h]hms}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh and }(hj4hhhNhNubj_)}(h ``bytes``h]hbytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj4ubh4 zero disables the quota limits unless at least one }(hj4hhhNhNubh)}(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_goalsuh1hhhhMkhj4ubh is set.}(hj4hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMkhjehhubh)}(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)}(hj$h]hgoal}(hj&hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj"ubah}(h]h ]h"]h$]h&]refdocj refdomainj0reftyperef refexplicitrefwarnjsysfs_schemes_quota_goalsuh1hhhhMthjubh9, the effective size quota is further adjusted. Reading }(hjhhhNhNubj_)}(h``effective_bytes``h]heffective_bytes}(hjFhhhNhNubah}(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}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to the relevant }(hjhhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMthjehhubh)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``age_permil``h]h age_permil}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) exist. You can set the }(hjhhhNhNubh)}(hH:ref:`prioritization weights `h]jq)}(hjh]hprioritization weights}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj(damon_design_damos_quotas_prioritizationuh1hhhhM}hjubhm 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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM}hjehhubj)}(h.. _sysfs_schemes_quota_goals:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-quota-goalsuh1jhMhjehhhhubeh}(h](schemes-n-quotasjYeh ]h"](schemes//quotas/ sysfs_quotaseh$]h&]uh1hhjEhhhhhMbj}jjOsj}jYjOsubh)}(hhh](h)}(hschemes//quotas/goals/h]hschemes//quotas/goals/}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhMubh)}(hThe directory for the :ref:`automatic quota tuning goals ` of the given DAMON-based operation scheme.h](hThe directory for the }(hj5hhhNhNubh)}(hK:ref:`automatic quota tuning goals `h]jq)}(hj?h]hautomatic quota tuning goals}(hjAhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj=ubah}(h]h ]h"]h$]h&]refdocj refdomainjKreftyperef refexplicitrefwarnj%damon_design_damos_quotas_auto_tuninguh1hhhhMhj5ubh+ of the given DAMON-based operation scheme.}(hj5hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj$hhubh)}(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, }(hjghhhNhNubj_)}(h ``nr_goals``h]hnr_goals}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjgubh. Writing a number (}(hjghhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjgubh<) to the file creates the number of child directories named }(hjghhhNhNubj_)}(h``0``h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjgubh to }(hjghhhNhNubj_)}(h``N-1``h]hN-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjgubhr. Each directory represents each goal and current achievement. Among the multiple feedback, the best one is used.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj$hhubh)}(hXEach goal directory contains four files, namely ``target_metric``, ``target_value``, ``current_value`` and ``nid``. Users can set and get the four 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](h0Each goal directory contains four files, namely }(hjhhhNhNubj_)}(h``target_metric``h]h target_metric}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``target_value``h]h target_value}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``current_value``h]h current_value}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``nid``h]hnid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhc. Users can set and get the four parameters for the quota auto-tuning goals that specified on the }(hjhhhNhNubh)}(h9:ref:`design doc `h]jq)}(hjh]h design doc}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj%damon_design_damos_quotas_auto_tuninguh1hhhhMhjubhY by writing to and reading from each of the files. Note that users should further write }(hjhhhNhNubj_)}(h``commit_schemes_quota_goals``h]hcommit_schemes_quota_goals}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to the }(hjhhhNhNubj_)}(h ``state``h]hstate}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh file of the }(hjhhhNhNubh)}(h(:ref:`kdamond directory `h]jq)}(hjWh]hkdamond directory}(hjYhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjUubah}(h]h ]h"]h$]h&]refdocj refdomainjcreftyperef refexplicitrefwarnj sysfs_kdamonduh1hhhhMhjubh to pass the feedback to DAMON.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj$hhubj)}(h.. _sysfs_watermarks:h]h}(h]h ]h"]h$]h&]jCsysfs-watermarksuh1jhMhj$hhhhubeh}(h](schemes-n-quotas-goalsjeh ]h"](schemes//quotas/goals/sysfs_schemes_quota_goalseh$]h&]uh1hhjEhhhhhMj}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 (}(hjhhhNhNubj_)}(h ``metric``h]hmetric}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``interval_us``h]h interval_us}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }(hjhhhNhNubj_)}(h``high``h]hhigh}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, }hjsbj_)}(h``mid``h]hmid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh, and }(hjhhhNhNubj_)}(h``low``h]hlow}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) 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.}(hjhhhNhNubeh}(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 }(hj@hhhNhNubj_)}(h ``metric``h]hmetric}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj@ubh file are as below.}(hj@hhhNhNubeh}(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)}(hjkh]hnone: Ignore the watermarks}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjiubah}(h]h ]h"]h$]h&]uh1hhjfubh)}(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&]uh1hhjfubeh}(h]h ]h"]h$]h&]j7j8uh1hhhhMhjbubah}(h]h ]h"]h$]h&]uh1j`hhhMhjhhubh)}(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}jjsj}jjsubh)}(hhh](h)}(h#schemes//{core\_,ops\_,}filters/h]h#schemes//{core_,ops_,}filters/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hfDirectories for :ref:`filters ` of the given DAMON-based operation scheme.h](hDirectories for }(hjhhhNhNubh)}(h+:ref:`filters `h]jq)}(hjh]hfilters}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhjubh+ of the given DAMON-based operation scheme.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h``ops_filters``h]h ops_filters}(hj3hhhNhNubah}(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}(hjEhhhNhNubah}(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}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }hjsbj_)}(h``ops_filters``h]h ops_filters}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh# will be installed before those of }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh). All three directories have same files.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh directories. The }(hjhhhNhNubj_)}(h ``filters``h]hfilters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh) directory could be deprecated in future.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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, }(hjhhhNhNubj_)}(h``nr_filters``h]h nr_filters}(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}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhZ. Each directory represents each filter. The filters are evaluated in the numeric order.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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 }(hj?hhhNhNubj_)}(h``type``h]htype}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }(hj?hhhNhNubj_)}(h ``matching``h]hmatching}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }(hj?hhhNhNubj_)}(h ``allow``h]hallow}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }hj?sbj_)}(h``memcg_path``h]h memcg_path}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }hj?sbj_)}(h``addr_start``h]h addr_start}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }hj?sbj_)}(h ``addr_end``h]haddr_end}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }hj?sbj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh, }hj?sbj_)}(h``max``h]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh and }(hj?hhhNhNubj_)}(h``target_idx``h]h target_idx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh. To }(hj?hhhNhNubj_)}(h``type``h]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj?ubh6 file, you can write the type of the filter. Refer to }(hj?hhhNhNubh)}(h2:ref:`the design doc `h]jq)}(hjh]hthe design doc}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhj?ubhM for available type names, their meaning and on what layer those are handled.}(hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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 }(hj%hhhNhNubj_)}(h ``memcg``h]hmemcg}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh type, you can specify the memory cgroup of the interest by writing the path of the memory cgroup from the cgroups mount point to }(hj%hhhNhNubj_)}(h``memcg_path``h]h memcg_path}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh file. For }(hj%hhhNhNubj_)}(h``addr``h]haddr}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubhW type, you can specify the start and end address of the range (open-ended interval) to }(hj%hhhNhNubj_)}(h``addr_start``h]h addr_start}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh and }(hj%hhhNhNubj_)}(h ``addr_end``h]haddr_end}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh files, respectively. For }(hj%hhhNhNubj_)}(h``hugepage_size``h]h hugepage_size}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubhV type, you can specify the minimum and maximum size of the range (closed interval) to }(hj%hhhNhNubj_)}(h``min``h]hmin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh and }hj%sbj_)}(h``max``h]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh files, respectively. For }(hj%hhhNhNubj_)}(h ``target``h]htarget}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubht type, you can specify the index of the target between the list of the DAMON context’s monitoring targets list to }(hj%hhhNhNubj_)}(h``target_idx``h]h target_idx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh file.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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 }(hjhhhNhNubj_)}(h``Y``h]hY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh or }(hjhhhNhNubj_)}(h``N``h]hN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h ``matching``h]hmatching}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhC file to specify whether the filter is for memory that matches the }(hjhhhNhNubj_)}(h``type``h]htype}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh. You can write }(hjhhhNhNubj_)}(h``Y``h]hY}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh or }hjsbj_)}(h``N``h]hN}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh to }(hjhhhNhNubj_)}(h ``allow``h]hallow}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhI file to specify if applying the action to the memory that satisfies the }(hjhhhNhNubj_)}(h``type``h]htype}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh and }(hjhhhNhNubj_)}(h ``matching``h]hmatching}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubh should be allowed or not.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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&]uh1hhhhMhjhhubj)}(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&]hhuh1jhhhMhjhhubh)}(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 }(hjhhhNhNubh)}(hF:ref:`DAMOS filters design documentation `h]jq)}(hjh]h"DAMOS filters design documentation}(hjhhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdamon_design_damos_filtersuh1hhhhMhjubh> for more details including how multiple filters of different }(hjhhhNhNubj_)}(h ``allow``h]hallow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjubhI works, when each of the filters are supported, and differences on stats.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _damon_sysfs_dests:h]h}(h]h ]h"]h$]h&]jCdamon-sysfs-destsuh1jhMhjhhhhubeh}(h](schemes-n-core-ops-filtersjeh ]h"](!schemes//{core_,ops_,}filters/ sysfs_filterseh$]h&]uh1hhjEhhhhhMj}j jsj}jjsubh)}(hhh](h)}(hschemes//dests/h]hschemes//dests/}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hXDirectory for specifying the destinations of given DAMON-based operation scheme's action. This directory is ignored if the action of the given scheme is not supporting multiple destinations. Only ``DAMOS_MIGRATE_{HOT,COLD}`` actions are supporting multiple destinations.h](hDirectory for specifying the destinations of given DAMON-based operation scheme’s action. This directory is ignored if the action of the given scheme is not supporting multiple destinations. Only }(hj0 hhhNhNubj_)}(h``DAMOS_MIGRATE_{HOT,COLD}``h]hDAMOS_MIGRATE_{HOT,COLD}}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj0 ubh. actions are supporting multiple destinations.}(hj0 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hIn the beginning, the directory has only one file, ``nr_dests``. Writing a number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each action destination.h](h3In the beginning, the directory has only one file, }(hjP hhhNhNubj_)}(h ``nr_dests``h]hnr_dests}(hjX hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjP ubh. Writing a number (}(hjP hhhNhNubj_)}(h``N``h]hN}(hjj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjP ubh<) to the file creates the number of child directories named }(hjP hhhNhNubj_)}(h``0``h]h0}(hj| hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjP ubh to }(hjP hhhNhNubj_)}(h``N-1``h]hN-1}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjP ubh5. Each directory represents each action destination.}(hjP hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXBEach destination directory contains two files, namely ``id`` and ``weight``. Users can write and read the identifier of the destination to ``id`` file. For ``DAMOS_MIGRATE_{HOT,COLD}`` actions, the migrate destination node's node id should be written to ``id`` file. Users can write and read the weight of the destination among the given destinations to the ``weight`` file. The weight can be an arbitrary integer. When DAMOS apply the action to each entity of the memory region, it will select the destination of the action based on the relative weights of the destinations.h](h6Each destination directory contains two files, namely }(hj hhhNhNubj_)}(h``id``h]hid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh and }(hj hhhNhNubj_)}(h ``weight``h]hweight}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh@. Users can write and read the identifier of the destination to }(hj hhhNhNubj_)}(h``id``h]hid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file. For }(hj hhhNhNubj_)}(h``DAMOS_MIGRATE_{HOT,COLD}``h]hDAMOS_MIGRATE_{HOT,COLD}}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhH actions, the migrate destination node’s node id should be written to }(hj hhhNhNubj_)}(h``id``h]hid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubhc file. Users can write and read the weight of the destination among the given destinations to the }(hj hhhNhNubj_)}(h ``weight``h]hweight}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj ubh file. The weight can be an arbitrary integer. When DAMOS apply the action to each entity of the memory region, it will select the destination of the action based on the relative weights of the destinations.}(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-destsj eh ]h"](schemes//dests/damon_sysfs_destseh$]h&]uh1hhjEhhhhhMj}j1!j sj}j j subh)}(hhh](h)}(hschemes//stats/h]hschemes//stats/}(hj9!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj6!hhhhhM ubh)}(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 }(hjG!hhhNhNubh)}(h+:ref:`design doc `h]jq)}(hjQ!h]h design doc}(hjS!hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphjO!ubah}(h]h ]h"]h$]h&]refdocj refdomainj]!reftyperef refexplicitrefwarnjdamon_design_damos_statuh1hhhhM hjG!ubh" for more details about the stats.}(hjG!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj6!hhubh)}(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 }(hjy!hhhNhNubj_)}(h ``stats``h]hstats}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh directory (}(hjy!hhhNhNubj_)}(h ``nr_tried``h]hnr_tried}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh, }(hjy!hhhNhNubj_)}(h ``sz_tried``h]hsz_tried}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh, }hjy!sbj_)}(h``nr_applied``h]h nr_applied}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh, }hjy!sbj_)}(h``sz_applied``h]h sz_applied}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh, }(hjy!hhhNhNubj_)}(h``sz_ops_filter_passed``h]hsz_ops_filter_passed}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh, and }(hjy!hhhNhNubj_)}(h``qt_exceeds``h]h qt_exceeds}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh), 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, }(hjy!hhhNhNubj_)}(h``update_schemes_stats``h]hupdate_schemes_stats}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh to the relevant }(hjy!hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjy!ubh file.}(hjy!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj6!hhubj)}(h .. _sysfs_schemes_tried_regions:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-tried-regionsuh1jhMhj6!hhhhubeh}(h](schemes-n-statsj*!eh ]h"](schemes//stats/sysfs_schemes_statseh$]h&]uh1hhjEhhhhhM j}j:"j !sj}j*!j !subh)}(hhh](h)}(hschemes//tried_regions/h]hschemes//tried_regions/}(hjB"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj?"hhhhhMubh)}(h7This directory initially has one file, ``total_bytes``.h](h'This directory initially has one file, }(hjP"hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hjX"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjP"ubh.}(hjP"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, }(hjp"hhhNhNubj_)}(h ``update_schemes_tried_regions``h]hupdate_schemes_tried_regions}(hjx"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh, is written to the relevant }(hjp"hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh file, DAMON updates the }(hjp"hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh file so that reading it returns the total size of the scheme tried regions, and creates directories named integer starting from }(hjp"hhhNhNubj_)}(h``0``h]h0}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh under this directory. Each directory contains files exposing detailed information about each of the memory region that the corresponding scheme’s }(hjp"hhhNhNubj_)}(h ``action``h]haction}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh; has tried to be applied under this directory, during next }(hjp"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_damosuh1hhhhMhjp"ubhG of the corresponding scheme. The information includes address range, }(hjp"hhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh, and }(hjp"hhhNhNubj_)}(h``age``h]hage}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjp"ubh of the region.}(hjp"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 }(hj #hhhNhNubj_)}(h``update_schemes_tried_bytes``h]hupdate_schemes_tried_bytes}(hj(#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj #ubh to the relevant }(hj #hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj:#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj #ubh file will only update the }(hj #hhhNhNubj_)}(h``total_bytes``h]h total_bytes}(hjL#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj #ubh. file, and will not create the subdirectories.}(hj #hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM(hj?"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, }(hjd#hhhNhNubj_)}(h``clear_schemes_tried_regions``h]hclear_schemes_tried_regions}(hjl#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjd#ubh, is written to the relevant }(hjd#hhhNhNubj_)}(h``kdamonds//state``h]hkdamonds//state}(hj~#hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjd#ubh file.}(hjd#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&]uh1hhhhM0hj?"hhubj)}(h.. _sysfs_schemes_tried_region:h]h}(h]h ]h"]h$]h&]jCsysfs-schemes-tried-regionuh1jhM5hj?"hhhhubeh}(h](schemes-n-tried-regionsj3"eh ]h"](schemes//tried_regions/sysfs_schemes_tried_regionseh$]h&]uh1hhjEhhhhhMj}j#j)"sj}j3"j)"subh)}(hhh](h)}(htried_regions//h]htried_regions//}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#hhhhhM8ubh)}(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 (}(hj$hhhNhNubj_)}(h ``start``h]hstart}(hj $hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubh, }(hj$hhhNhNubj_)}(h``end``h]hend}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubh, }(hj$hhhNhNubj_)}(h``nr_accesses``h]h nr_accesses}(hj-$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubh, }hj$sbj_)}(h``age``h]hage}(hj?$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubh, and }(hj$hhhNhNubj_)}(h``sz_filter_passed``h]hsz_filter_passed}(hjQ$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubhm). Reading the files will show the properties of the region that corresponding DAMON-based operation scheme }(hj$hhhNhNubj_)}(h ``action``h]haction}(hjc$hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj$ubh has tried to be applied.}(hj$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM:hj#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&]uh1hhhhMBhj{$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&]hhuh1jhhhMKhj{$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&]uh1hhjEhhhhhM8j}j$j#sj}j#j#subeh}(h](jDid1eh ]h"](sysfs interfacesysfs_interfaceeh$]h&]uh1hhhhhhhhK!j}j$j9sj}jDj9subh)}(hhh](h)}(h"Tracepoints for Monitoring Resultsh]h"Tracepoints for Monitoring Results}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%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.Jh](h-Users can get the monitoring results via the }(hj%hhhNhNubh)}(h2:ref:`tried_regions `h]jq)}(hj%h]h tried_regions}(hj%hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj%ubah}(h]h ]h"]h$]h&]refdocj refdomainj(%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}(hjP%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh, are provided. }(hj%hhhNhNubj_)}(h``damon:damon_aggregated``h]hdamon:damon_aggregated}(hjb%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}(hjt%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&]uh1hhhhMlhj%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 }(hj%hhhNhNubj_)}(h``perf``h]hperf}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj%ubh. For example:}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMyhj%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 [...]}hj&sbah}(h]h ]h"]h$]h&]hhuh1jhhhM|hj%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}(hj&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}(hj.&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}(hjR&hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj&ubh ) and end (}(hj&hhhNhNubj_)}(h``Y``h]hY}(hjd&hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj&ubh6) addresses of the region in bytes. The ninth field (}(hj&hhhNhNubj_)}(h``X``h]hX}(hjv&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&hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj&ubah}(h]h ]h"]h$]h&]refdocj refdomainj&reftyperef refexplicitrefwarnj"damon_design_region_based_samplinguh1hhhhMhj&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}(hj&hhhNhNubah}(h]h ](j|stdstd-refeh"]h$]h&]uh1jphj&ubah}(h]h ]h"]h$]h&]refdocj refdomainj&reftyperef refexplicitrefwarnjdamon_design_age_trackinguh1hhhhMhj&ubh" for more details of the counter).}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj%hhubh)}(hhIf the event was ``damon:damos_beofre_apply``, the ``perf script`` output would be somewhat like below::h](hIf the event was }(hj 'hhhNhNubj_)}(h``damon:damos_beofre_apply``h]hdamon:damos_beofre_apply}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj 'ubh, the }(hj 'hhhNhNubj_)}(h``perf script``h]h perf script}(hj&'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hj 'ubh% output would be somewhat like below:}(hj 'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj%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&]hhuh1jhhhMhj%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 (}(hjL'hhhNhNubj_)}(h ``ctx_idx=X``h]h ctx_idx=X}(hjT'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL'ubha) of the scheme in the list of the contexts of the context’s kdamond, the index of the scheme (}(hjL'hhhNhNubj_)}(h``scheme_idx=X``h]h scheme_idx=X}(hjf'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL'ubhJ) in the list of the schemes of the context, in addition to the output of }(hjL'hhhNhNubj_)}(h``damon_aggregated``h]hdamon_aggregated}(hjx'hhhNhNubah}(h]h ]h"]h$]h&]uh1j^hjL'ubh tracepoint.}(hjL'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj%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]j aj]jaj ]j aj ]j aj ]j aj']jaj]jaj ]jaj]jaj]jajJ]j@aj]jaj]jajY]jOaj]jaj]jaj]jaj ]j aj*!]j !aj3"]j)"aj#]j#aj$]j$aunameids}(j'j'jjj>j;jjj$jDj$j$jjjjjjjjjjj jj j j j j j j j j j j.j j-j*jj'jjjjjjjj jjjjjjjQjjPjMjjJjjjjjj j`jj_j\jjYjjjjjjjjjjj jj j j1!j j0!j-!j:"j*!j9"j6"j#j3"j#j#j$j#j$j$j$j$j$j$j'j$j'j'u nametypes}(j'jj>jj$j$jjjjjj j j j j j j.j-jjjjjjjjjQjPjjjjj`j_jjjjjjj j j1!j0!j:"j9"j#j#j$j$j$j$j'j'uh}(j'hjjj;j5jjjDjEj$jEjjjjjjjj!jj!jjj jj j j j j j j j j j j*j j'j3jj3jjjjj jjjjjjjjjjMjjJjVjjVjjj jjjj\jjYjejjejj$jj$jjjjjjj jj j j-!j j*!j6!j6"j6!j3"j?"j#j?"j#j#j$j#j$j{$j$j$j$j%j'j%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.}hjG(sbah}(h]h ]h"]h$]h&]uh1hhjD(ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jB(ubjC()}(hhh]h)}(hhh]h0Hyperlink target "sysfs-root" is not referenced.}hjb(sbah}(h]h ]h"]h$]h&]uh1hhj_(ubah}(h]h ]h"]h$]h&]levelKtypej\(sourcehlineKbuh1jB(ubjC()}(hhh]h)}(hhh]h4Hyperlink target "sysfs-kdamonds" is not referenced.}hj|(sbah}(h]h ]h"]h$]h&]uh1hhjy(ubah}(h]h ]h"]h$]h&]levelKtypej\(sourcehlineKluh1jB(ubjC()}(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\(sourcehlineKyuh1jB(ubjC()}(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\(sourcehlineKuh1jB(ubjC()}(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\(sourcehlineKuh1jB(ubjC()}(hhh]h)}(hhh]h