mm/damon: add lru-active probe filter type
Subsystems (4)
SJ Park
maintainercover mm/damon: add lru-active probe filter type
The LRU-activeness of folios is useful information for understanding and optimizing the system. DAMOS ops filter therefore supports filtering memory based on the information. Using it, the information can be extracted in the folio granularity. It is precise but expensive. DAMON probe filter is the complementary way for getting the information in region granularity with much cheaper cost. DAMON filter does not support LRU-activeness based filtering, though. Add the support.
Define new DAMON filter type, DAMON_FILTER_TYPE_ACTIVE, on core API (patch 1). Add support for it on both vaddr and paddr operation set (patch 2). Extend DAMON filter sysfs ABI to let users configure DAMON filters of the type using a new keyword, "active" (patch 3). Finally, update the DAMON design document to explain the new type (patch 4).
SJ Park (4):
mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation mm/damon/sysfs: support LRU-activeness based DAMON filter setup Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
Documentation/mm/damon/design.rst | 1 + include/linux/damon.h | 2 ++ mm/damon/ops-common.c | 7 +++++++ mm/damon/sysfs.c | 4 ++++ 4 files changed, 14 insertions(+)
base-commit: 50061821991431146db6bd16b571742c06146d30
Signature · 1 line
2.47.3
SJ Park
maintainerRFC PATCH 1/4 mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE
Knowing which memory is on Active LRU lists is useful for understanding and optimally operating systems. Extend the DAMON core layer to be ready for support of that. For that, define a new damon_filter_type, DAMON_FILTER_TYPE_ACTIVE. It has no additional arguments and therefore no additional change in the core layer is needed. Testing if a given memory is on an LRU list for the type of filter should be implemented in the operation set layer.
--- include/linux/damon.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/damon.h +2 -0
@@ -780,6 +780,7 @@ struct damon_prep {* @DAMON_FILTER_TYPE_PGIDLE_UNSET: Pgidle is unset. * @DAMON_FILTER_TYPE_PGIDLE_SET: Pgidle is set. * @DAMON_FILTER_TYPE_HUGEPAGE_SIZE: Page is part of a hugepage. +* @DAMON_FILTER_TYPE_ACTIVE: LRU-active pages. */ enum damon_filter_type {DAMON_FILTER_TYPE_ANON ,
@@ -787,6 +788,7 @@ enum damon_filter_type {DAMON_FILTER_TYPE_PGIDLE_UNSET ,DAMON_FILTER_TYPE_PGIDLE_SET ,DAMON_FILTER_TYPE_HUGEPAGE_SIZE , + DAMON_FILTER_TYPE_ACTIVE, };/**
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [RFC PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE
Sashiko has reviewed this patch and found no issues.
Quoted 9 lines
Knowing which memory is on Active LRU lists is useful for understanding and optimally operating systems. Extend the DAMON core layer to be ready for support of that. For that, define a new
damon_filter_type,DAMON_FILTER_TYPE_ACTIVE. It has no additional arguments and therefore no additional change in the core layer is needed. Testing if a given memory is on an LRU list for the type of filter should be implemented in the operation set layer.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
SJ Park
maintainerRFC PATCH 2/4 mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation
In reply to SJ ParkImplement DAMON_FILTER_TYPE_ACTIVE operation. Use folio_test_active() to show if the folio of the given memory is on an active LRU list. The implementation is made on ops-common, so both vaddr and paddr gain the support of the filter type.
--- mm/damon/ops-common.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/damon/ops-common.c +7 -0
@@ -574,6 +574,13 @@ bool damon_ops_filter_match(struct damon_filter *filter, struct folio *folio) matched = filter->range_min <= folio_sz && folio_sz <= filter->range_max;break ; +case DAMON_FILTER_TYPE_ACTIVE : +if (!folio) { + matched = false; +break ; + } + matched =folio_test_active (folio); +break ;default :break ; }
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [RFC PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
Implement
DAMON_FILTER_TYPE_ACTIVEoperation. Usefolio_test_active()to show if the folio of the given memory is on an active LRU list. The implementation is made on ops-common, so both vaddr and paddr gain the support of the filter type.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
SJ Park
maintainerRFC PATCH 3/4 mm/damon/sysfs: support LRU-activeness based DAMON filter setup
In reply to SJ ParkSupport DAMON sysfs interface based setup of DAMON_FILTER_TYPE_ACTIVE type DAMON filters. For that, wire the type with a new user keyword, "active". Users can set up the new type of filter using the existing DAMON filter setup interface with the new keyword.
--- mm/damon/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/damon/sysfs.c +4 -0
@@ -1011,6 +1011,10 @@ damon_sysfs_filter_type_names[] = { .type = DAMON_FILTER_TYPE_HUGEPAGE_SIZE, .name = "hugepage_size", }, + { + .type = DAMON_FILTER_TYPE_ACTIVE, + .name = "active", + }, }; static ssize_t type_show(struct kobject *kobj,
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [RFC PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
Support DAMON sysfs interface based setup of
DAMON_FILTER_TYPE_ACTIVEtype DAMON filters. For that, wire the type with a new user keyword, "active". Users can set up the new type of filter using the existing DAMON filter setup interface with the new keyword.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
SJ Park
maintainerRFC PATCH 4/4 Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
In reply to SJ ParkUpdate DAMON design document for the newly added LRU-activeness DAMON filter type.
--- Documentation/mm/damon/design.rst | 1 + 1 file changed, 1 insertion(+)
Documentation/mm/damon/design.rst +1 -0
@@ -302,6 +302,7 @@ filter types. Currently below filter types are supported. - ``pgidle_set``: Matches if the page for the memory is marked as access-idle. - ``hugepage_size``: Matches if the page for the memory is a part of a hugepage of a given size range. +- ``active``: Same to that for DAMOS filters. If such probes are registered, DAMON executes the probes for each region's sampling memory when it does the access :ref:`sampling
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [RFC PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
Update DAMON design document for the newly added LRU-activeness DAMON filter type.
Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4