mm/damon/core: implement target type damos filter
authorSeongJae Park <sj@kernel.org>
Wed, 2 Aug 2023 21:43:07 +0000 (21:43 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 21 Aug 2023 20:37:37 +0000 (13:37 -0700)
commit17e7c724d3c2e622c4d9969b7a473e8ed1d14ff0
tree475b0a3aed6e47fda06c9ed6fdb3c874f901a56f
parent375af850385c787fc7115bf304c48b475818e5e4
mm/damon/core: implement target type damos filter

One DAMON context can have multiple monitoring targets, and DAMOS schemes
are applied to all targets.  In some cases, users need to apply different
scheme to different targets.  Retrieving monitoring results via DAMON
sysfs interface' 'tried_regions' directory could be one good example.
Also, there could be cases that cgroup DAMOS filter is not enough.  All
such use cases can be worked around by having multiple DAMON contexts
having only single target, but it is inefficient in terms of resource
usage, thogh the overhead is not estimated to be huge.

Implement DAMON monitoring target based DAMOS filter for the case.  Like
address range target DAMOS filter, handle these filters in the DAMON core
layer, since it is more efficient than doing in operations set layer.
This also means that regions that filtered out by monitoring target type
DAMOS filters are counted as not tried by the scheme.  Hence, target
granularity monitoring results retrieval via DAMON sysfs interface becomes
available.

Link: https://lkml.kernel.org/r/20230802214312.110532-9-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/damon.h
mm/damon/core.c