On Wed, 5 Aug 2020 08:59:41 +0200 SeongJae Park <sjpark@xxxxxxxxxx> wrote: > From: SeongJae Park <sjpark@xxxxxxxxx> > > Changes from Previous Version > ============================= > > - paddr: Support nested iomem sections (Du Fan) > - Rebase on v5.8 > > Introduction > ============ > > DAMON[1] programming interface users can extend DAMON for any address space by > configuring the address-space specific low level primitives with appropriate > ones including their own implementations. However, because the implementation > for the virtual address space is only available now, the users should implement > their own for other address spaces. Worse yet, the user space users who rely > on the debugfs interface and user space tool, cannot implement their own. > > This patchset implements another reference implementation of the low level > primitives for the physical memory address space. With this change, hence, the > kernel space users can monitor both the virtual and the physical address spaces > by simply changing the configuration in the runtime. Further, this patchset > links the implementation to the debugfs interface and the user space tool for > the user space users. > > Note that the implementation supports only the user memory, as same to the idle > page access tracking feature. > > [1] https://lore.kernel.org/linux-mm/20200706115322.29598-1-sjpark@xxxxxxxxxx/ This patchset doesn't works for physical address monitoring because I forgot below patch. Sorry for missing it. Please apply it before you test this patchset. Or, you can clone the patch applied complete git tree: $ git clone git://github.com/sjp38/linux -b cdamon/rfc/v6.1 The web is also available: https://github.com/sjp38/linux/releases/tag/cdamon/rfc/v6.1 The patch will be split and squashed in appropriate patch in the next spin. =============================== >8 =========================================== >From edf6b586f4ac3f8f4d61ebde56d644422bd93bee Mon Sep 17 00:00:00 2001 From: SeongJae Park <sjpark@xxxxxxxxx> Date: Thu, 6 Aug 2020 08:18:49 +0000 Subject: [PATCH] mm/damon: Fix paddr target id problem The target id for 'paddr' is meaningless, but we set it as '-1' for fun and smooth interaction with the user space interfaces. However, the target ids are 'unsigned long' and thus using '-1' makes no sense. This commit changes the fake number to another funny but unsigned number, '42'. Signed-off-by: SeongJae Park <sjpark@xxxxxxxxx> --- Documentation/admin-guide/mm/damon/usage.rst | 4 ++-- mm/damon.c | 2 +- tools/damon/_damon.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 88b8e9254a7e..3e2f1519c96a 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -334,12 +334,12 @@ check it again:: Users can also monitor the physical memory address space of the system by writing a special keyword, "``paddr\n``" to the file. Because physical address space monitoring doesn't support multiple targets, reading the file will show a -fake value, ``-1``, as below:: +fake value, ``42``, as below:: # cd <debugfs>/damon # echo paddr > target_ids # cat target_ids - -1 + 42 Note that setting the target ids doesn't start the monitoring. diff --git a/mm/damon.c b/mm/damon.c index a9757a0e5cf7..66268cb45b51 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -2047,7 +2047,7 @@ static ssize_t debugfs_target_ids_write(struct file *file, ctx->target_valid = NULL; /* target id is meaningless here, but we set it just for fun */ - snprintf(kbuf, count, "-1 "); + snprintf(kbuf, count, "42 "); } else { /* Configure the context for virtual memory monitoring */ ctx->init_target_regions = kdamond_init_vm_regions; diff --git a/tools/damon/_damon.py b/tools/damon/_damon.py index cf14a0d59b94..6ff278117e84 100644 --- a/tools/damon/_damon.py +++ b/tools/damon/_damon.py @@ -28,7 +28,7 @@ def set_target(tid, init_regions=[]): return 0 if tid == 'paddr': - tid = -1 + tid = 42 string = ' '.join(['%s %d %d' % (tid, r[0], r[1]) for r in init_regions]) return subprocess.call('echo "%s" > %s' % (string, debugfs_init_regions), shell=True, executable='/bin/bash') -- 2.17.1