The patch titled Subject: Docs/admin-guide/mm/damon/usage: document DAMOS filters of sysfs has been added to the -mm mm-unstable branch. Its filename is docs-admin-guide-mm-damon-usage-document-damos-filters-of-sysfs.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/docs-admin-guide-mm-damon-usage-document-damos-filters-of-sysfs.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: SeongJae Park <sj@xxxxxxxxxx> Subject: Docs/admin-guide/mm/damon/usage: document DAMOS filters of sysfs Date: Mon, 5 Dec 2022 23:08:29 +0000 Document about the newly added files for DAMOS filters on the DAMON usage document. Link: https://lkml.kernel.org/r/20221205230830.144349-11-sj@xxxxxxxxxx Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/mm/damon/usage.rst | 48 ++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) --- a/Documentation/admin-guide/mm/damon/usage.rst~docs-admin-guide-mm-damon-usage-document-damos-filters-of-sysfs +++ a/Documentation/admin-guide/mm/damon/usage.rst @@ -87,6 +87,8 @@ comma (","). :: â?? â?? â?? â?? â?? â?? â?? quotas/ms,bytes,reset_interval_ms â?? â?? â?? â?? â?? â?? â?? â?? weights/sz_permil,nr_accesses_permil,age_permil â?? â?? â?? â?? â?? â?? â?? watermarks/metric,interval_us,high,mid,low + â?? â?? â?? â?? â?? â?? â?? filters/nr_filters + â?? â?? â?? â?? â?? â?? â?? â?? 0/type,matching,memcg_id â?? â?? â?? â?? â?? â?? â?? stats/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds â?? â?? â?? â?? â?? â?? â?? tried_regions/ â?? â?? â?? â?? â?? â?? â?? â?? 0/start,end,nr_accesses,age @@ -151,6 +153,8 @@ number (``N``) to the file creates the n moment, only one context per kdamond is supported, so only ``0`` or ``1`` can be written to the file. +.. _sysfs_contexts: + contexts/<N>/ ------------- @@ -268,8 +272,8 @@ schemes/<N>/ ------------ In each scheme directory, five directories (``access_pattern``, ``quotas``, -``watermarks``, ``stats``, and ``tried_regions``) and one file (``action``) -exist. +``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file +(``action``) exist. The ``action`` file is for setting and getting what action you want to apply to memory regions having specific access pattern of the interest. The keywords @@ -347,6 +351,46 @@ as below. The ``interval`` should written in microseconds unit. +schemes/<N>/filters/ +-------------------- + +Users could know something more than the kernel for specific types of memory. +In the case, users could do their own management for the memory and hence +doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access +pattern of the scheme and/or the monitoring regions for the purpose, but that +can be inefficient in some cases. In such cases, users could set non-access +pattern driven filters using files in this directory. + +In the beginning, this 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. + +Each filter directory contains three files, namely ``type``, ``matcing``, and +``memcg_path``. You can write one of two special keywords, ``anon`` for +anonymous pages, or ``memcg`` for specific memory cgroup filtering. In case of +the memory cgroup filtering, 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. You can write ``Y`` or ``N`` to ``matching`` file to +filter out pages that does or does not match to the type, respectively. Then, +the scheme's action will not be applied to the pages that specified to be +filtered out. + +For example, below restricts a DAMOS action to be applied to only non-anonymous +pages of all memory cgroups except ``/having_care_already``.:: + + # echo 2 > nr_filters + # # filter out anonymous pages + echo anon > 0/type + echo Y > 0/matching + # # further filter out all cgroups except one at '/having_care_already' + echo memcg > 1/type + echo /having_care_already > 1/memcg_path + echo N > 1/matching + +Note that filters could be ignored depend on the running DAMON operations set +`implementation <sysfs_contexts>`. + .. _sysfs_schemes_stats: schemes/<N>/stats/ _ Patches currently in -mm which might be from sj@xxxxxxxxxx are mm-damon-core-implement-damos-filter.patch mm-damon-paddr-support-damos-filters.patch mm-damon-reclaim-add-a-parameter-called-skip_anon-for-avoiding-anonymous-pages-reclamation.patch docs-admin-guide-damon-reclaim-document-skip_anon-parameter.patch mm-damon-sysfs-schemes-implement-filters-directory.patch mm-damon-sysfs-schemes-implement-filter-directory.patch mm-damon-sysfs-schemes-connect-filter-directory-and-filters-directory.patch mm-damon-sysfs-schemes-implement-scheme-filters.patch selftests-damon-sysfs-test-filters-directory.patch docs-admin-guide-mm-damon-usage-document-damos-filters-of-sysfs.patch docs-abi-damon-document-scheme-filters-files.patch