[RFC v2 7/7] mm/damon/sysfs: support paddr_fault

SeongJae Park posted 7 patches 2 months, 1 week ago
[RFC v2 7/7] mm/damon/sysfs: support paddr_fault
Posted by SeongJae Park 2 months, 1 week ago
Extend DAMON sysfs interface to support the page faults based physical
address space access monitoring.  Users can use it by writing
paddr_fault to the ops file.  For simple testing, the DAMON user-space
tool can be used as below, after applying below hack.

    $ git diff
    --- a/src/_damon_sysfs.py
    +++ b/src/_damon_sysfs.py
    @@ -548,7 +548,7 @@ def write_monitoring_attrs_dir(dir_path, context):

     def write_context_dir(dir_path, context):
         err = _damo_fs.write_file(os.path.join(dir_path, 'operations'),
    -                              context.ops)
    +                              'paddr_fault')
         if err is not None:
             return err

    $ sudo ./damo start
    $ sudo ./damo report access

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 6d2b0dab50cb..b1bf43972491 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -829,6 +829,10 @@ static const struct damon_sysfs_ops_name damon_sysfs_ops_names[] = {
 		.ops_id = DAMON_OPS_PADDR,
 		.name = "paddr",
 	},
+	{
+		.ops_id = DAMON_OPS_PADDR_FAULT,
+		.name = "paddr_fault",
+	},
 };
 
 struct damon_sysfs_context {
-- 
2.39.5