mm/damon: introduce DAMOS filter type for active pages
Subsystems (4)
cover mm/damon: introduce DAMOS filter type for active pages
The memory reclaim algorithm categorizes pages into active and inactive lists, separately for file and anon pages. The system's performance relies heavily on the (relative and absolute) accuracy of this categorization.
This patch series add a new DAMOS filter for pages' activeness, giving us visibility into the access frequency of the pages on each list. This insight can help us diagnose issues with the active-inactive balancing dynamics, and make decisions to optimize reclaim efficiency and memory utilization.
For instance, we might decide to enable DAMON_LRU_SORT, if we find that there are pages on the active list that are infrequently accessed, or less frequently accessed than pages on the inactive list.
Nhat Pham (2):
mm/damon: implement a new DAMOS filter type for active pages Docs/mm/damon/design: document active DAMOS filter type
Documentation/mm/damon/design.rst | 2 ++ include/linux/damon.h | 2 ++ mm/damon/paddr.c | 3 +++ mm/damon/sysfs-schemes.c | 1 + 4 files changed, 8 insertions(+)
base-commit: 40caf747267c18b6206e26a37d6ea6b695236c11
Signature · 1 line
2.47.1
PATCH 1/2 mm/damon: implement a new DAMOS filter type for active pages
Implement a DAMOS filter type for active pages on DAMON kernel API, and add support of it from the physical address space DAMON operations set (paddr).
--- include/linux/damon.h | 2 ++ mm/damon/paddr.c | 3 +++ mm/damon/sysfs-schemes.c | 1 + 3 files changed, 6 insertions(+)
include/linux/damon.h +2 -0
@@ -334,6 +334,7 @@ struct damos_stat {/** * enum damos_filter_type - Type of memory for &struct damos_filter * @DAMOS_FILTER_TYPE_ANON: Anonymous pages. +* @DAMOS_FILTER_TYPE_ACTIVE: Active pages. * @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages. * @DAMOS_FILTER_TYPE_YOUNG: Recently accessed pages. * @DAMOS_FILTER_TYPE_HUGEPAGE_SIZE: Page is part of a hugepage.
@@ -355,6 +356,7 @@ struct damos_stat {*/ enum damos_filter_type {DAMOS_FILTER_TYPE_ANON , +DAMOS_FILTER_TYPE_ACTIVE ,DAMOS_FILTER_TYPE_MEMCG ,DAMOS_FILTER_TYPE_YOUNG ,DAMOS_FILTER_TYPE_HUGEPAGE_SIZE ,
mm/damon/paddr.c +3 -0
@@ -217,6 +217,9 @@ static bool damos_pa_filter_match(struct damos_filter *filter,case DAMOS_FILTER_TYPE_ANON : matched =folio_test_anon (folio);break ; +case DAMOS_FILTER_TYPE_ACTIVE : + matched =folio_test_active (folio); +break ;case DAMOS_FILTER_TYPE_MEMCG :rcu_read_lock (); memcg =folio_memcg_check (folio);
mm/damon/sysfs-schemes.c +1 -0
@@ -344,6 +344,7 @@ static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(/* Should match with enum damos_filter_type */ static const char *const damon_sysfs_scheme_filter_type_strs[] = {"anon" , +"active" ,"memcg" ,"young" ,"hugepage_size" ,
Signature · 1 line
2.47.1
Re: [PATCH 1/2] mm/damon: implement a new DAMOS filter type for active pages
Quoted 3 lines · On Tue, 18 Mar 2025 11:30:28 -0700 Nhat Pham <[email protected]> wrote:
Implement a DAMOS filter type for active pages on DAMON kernel API, and add support of it from the physical address space DAMON operations set (paddr).
Great, thank you for this patch!
Quoted 3 lines
Suggested-by SeongJae Park <[email protected]>Signed-off-by Nhat Pham <[email protected]>
Thanks,
SJ
[...]
PATCH 2/2 Docs/mm/damon/design: document active DAMOS filter type
In reply to Nhat PhamDocument availability and meaning of "active" DAMOS filter type on design document. Since introduction of the type requires no additional user ABI, usage and ABI document need no update.
--- Documentation/mm/damon/design.rst | 2 ++ 1 file changed, 2 insertions(+)
Documentation/mm/damon/design.rst +2 -0
@@ -656,6 +656,8 @@ Below ``type`` of filters are currently supported. - Operations layer handled, supported by only ``paddr`` operations set. - anon - Applied to pages that containing data that not stored in files. + - active + - Applied to active pages. - memcg - Applied to pages that belonging to a given cgroup. - young
Signature · 1 line
2.47.1
Re: [PATCH 2/2] Docs/mm/damon/design: document active DAMOS filter type
Quoted 3 lines · On Tue, 18 Mar 2025 11:30:29 -0700 Nhat Pham <[email protected]> wrote:
Document availability and meaning of "active" DAMOS filter type on design document. Since introduction of the type requires no additional user ABI, usage and ABI document need no update.
Thank you for keeping the document updated for this nice new feature!
Quoted 3 lines
Suggested-by SeongJae Park <[email protected]>Signed-off-by Nhat Pham <[email protected]>
Thanks,
SJ
Quoted 19 lines
--- Documentation/mm/damon/design.rst | 2 ++ 1 file changed, 2 insertions(+)Documentation/mm/damon/design.rst +2
-0@@ -656,6 +656,8 @@ Below ``type`` of filters are currently supported. - Operations layer handled, supported by only ``paddr`` operations set. - anon - Applied to pages that containing data that not stored in files. + - active + - Applied to active pages. - memcg - Applied to pages that belonging to a given cgroup. - youngSignature · 1 line
2.47.1
SeongJae Park
maintainerHi Nhat,
Quoted 11 lines · On Tue, 18 Mar 2025 11:30:27 -0700 Nhat Pham <[email protected]> wrote:
The memory reclaim algorithm categorizes pages into active and inactive lists, separately for file and anon pages. The system's performance relies heavily on the (relative and absolute) accuracy of this categorization.
This patch series add a new DAMOS filter for pages' activeness, giving us visibility into the access frequency of the pages on each list. This insight can help us diagnose issues with the active-inactive balancing dynamics, and make decisions to optimize reclaim efficiency and memory utilization.
Quoted 3 lines
For instance, we might decide to enable
DAMON_LRU_SORT, if we find that there are pages on the active list that are infrequently accessed, or less frequently accessed than pages on the inactive list.
I agree to all the points, and thank you very much for this great patch series.
For other readers' information, DAMOS filters are for visibility of not only the human users, but also DAMOS itself. This new filter type will also be very useful at making DAMOS schemes that respects LRU information (e.g., reclaim DAMON-found cold pages but only if it is on inactive LRU list).
Thanks,
SJ
[...]