mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics
Subsystems (3)
v5 cover mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics
This patch introduces two new DAMOS quota goal metrics for controlling memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring.
Changes since v4:
=================
https://lore.kernel.org/linux-mm/[email protected]/
- Fixed commit message description for DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP per review feedback
- Added clarifying comment for ops-common.h include (for damon_get_folio())
- Fixed build error when CONFIG_DAMON_PADDR is disabled by adding #ifdef CONFIG_DAMON_PADDR guards around functions using damon_get_folio()
- Dropped RFC tag per maintainer feedback
This patch is based on top of damon/next.
Background and Motivation
=========================
In heterogeneous memory systems, controlling memory distribution across NUMA nodes is essential for performance optimization. This patch enables system-wide page distribution with target-state goals such as "maintain 30% of scheme-eligible memory on CXL" using PA-mode DAMON schemes.
What These Metrics Measure
==========================
node_eligible_mem_bp:
scheme_eligible_bytes_on_node / total_scheme_eligible_bytes * 10000
node_ineligible_mem_bp:
(total - scheme_eligible_bytes_on_node) / total * 10000
These metrics are complementary: eligible_bp + ineligible_bp = 10000 bp.
Two-Scheme Setup for Hot Page Distribution
==========================================
For maintaining hot memory on DRAM (node 0) and CXL (node 1) in a 7:3 ratio:
PUSH scheme: migrate_hot from node 0 -> node 1
goal: node_ineligible_mem_bp, nid=0, target=3000
"Move hot pages from DRAM to CXL if more than 70% of hot data is
in DRAM"
PULL scheme: migrate_hot from node 1 -> node 0
goal: node_eligible_mem_bp, nid=0, target=7000
"Move hot pages from CXL to DRAM if less than 70% of hot data is
in DRAM"The complementary goals create a feedback loop that converges to the target distribution.
Testing Results
===============
Functionally tested on a two-node heterogeneous memory system with DRAM (node 0) and CXL memory (node 1). A PUSH+PULL scheme configuration using migrate_hot actions was used to reach a target hot memory ratio between the two tiers. Testing used the TEMPORAL goal tuner available in damon/next and mm-unstable.
With the TEMPORAL tuner, the system converges quickly to the target distribution. The tuner drives esz to maximum when under goal and to zero once the goal is met, forming a simple on/off feedback loop that stabilizes at the desired ratio.
With the CONSIST tuner, the scheme still converges but more slowly, as it migrates and then throttles itself based on quota feedback. The time to reach the goal varies depending on workload intensity.
Note: These metrics work with both TEMPORAL and CONSIST goal tuners.
Ravi Jonnalagadda (1):
mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal
metrics
include/linux/damon.h | 6 ++ mm/damon/core.c | 186 ++++++++++++++++++++++++++++++++++++--- mm/damon/sysfs-schemes.c | 12 +++ 3 files changed, 190 insertions(+), 14 deletions(-)
base-commit: 97eefd14af390e1921f1fc5507140025095634e0
Signature · 1 line
2.43.0
PATCH v5 1/1 mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics
Add new quota goal metrics for memory tiering that track scheme-eligible memory distribution across NUMA nodes:
- DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: ratio of eligible memory on a node
- DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP: ratio of ineligible memory on a node
These complementary metrics enable push-pull migration schemes that maintain a target memory distribution across different NUMA nodes representing different memory tiers, based on access patterns defined by each scheme.
The metrics iterate scheme-eligible regions and use damon_get_folio() to determine NUMA node placement of each folio, calculating the ratio of eligible memory on the specified node versus total eligible memory.
The implementation is guarded by CONFIG_DAMON_PADDR since damon_get_folio() is only available when physical address space monitoring is enabled.
--- include/linux/damon.h | 6 ++ mm/damon/core.c | 186 ++++++++++++++++++++++++++++++++++++--- mm/damon/sysfs-schemes.c | 12 +++ 3 files changed, 190 insertions(+), 14 deletions(-)
include/linux/damon.h +6 -0
@@ -193,6 +193,10 @@ enum damos_action {* @DAMOS_QUOTA_NODE_MEMCG_FREE_BP: MemFree ratio of a node for a cgroup. * @DAMOS_QUOTA_ACTIVE_MEM_BP: Active to total LRU memory ratio. * @DAMOS_QUOTA_INACTIVE_MEM_BP: Inactive to total LRU memory ratio. +* @DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: Scheme-eligible memory ratio of a +* node. +* @DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP: Scheme-ineligible memory ratio of a +* node. * @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics. * * Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupported.
@@ -206,6 +210,8 @@ enum damos_quota_goal_metric {DAMOS_QUOTA_NODE_MEMCG_FREE_BP ,DAMOS_QUOTA_ACTIVE_MEM_BP ,DAMOS_QUOTA_INACTIVE_MEM_BP , +DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP , +DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP , NR_DAMOS_QUOTA_GOAL_METRICS, };
mm/damon/core.c +172 -14
266 lines not on this page · raw message
mm/damon/sysfs-schemes.c +12 -0
@@ -1084,6 +1084,14 @@ struct damos_sysfs_qgoal_metric_name damos_sysfs_qgoal_metric_names[] = { .metric = DAMOS_QUOTA_INACTIVE_MEM_BP, .name = "inactive_mem_bp", }, + { + .metric = DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP, + .name = "node_eligible_mem_bp", + }, + { + .metric = DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP, + .name = "node_ineligible_mem_bp", + }, }; static ssize_t target_metric_show(struct kobject *kobj,
@@ -2717,6 +2725,10 @@ static int damos_sysfs_add_quota_score(case DAMOS_QUOTA_NODE_MEM_FREE_BP : goal->nid = sysfs_goal->nid;break ; +case DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP : +case DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP : + goal->nid = sysfs_goal->nid; +break ;case DAMOS_QUOTA_NODE_MEMCG_USED_BP :case DAMOS_QUOTA_NODE_MEMCG_FREE_BP : err = damon_sysfs_memcg_path_to_id(
Signature · 1 line
2.43.0
SeongJae Park
maintainerQuoted 16 lines · On Fri, 3 Apr 2026 18:22:15 -0700 Ravi Jonnalagadda <[email protected]>…
Add new quota goal metrics for memory tiering that track scheme-eligible memory distribution across NUMA nodes:
-
DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: ratio of eligible memory on a node
-DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP: ratio of ineligible memory on a nodeThese complementary metrics enable push-pull migration schemes that maintain a target memory distribution across different NUMA nodes representing different memory tiers, based on access patterns defined by each scheme.
The metrics iterate scheme-eligible regions and use
damon_get_folio()to determine NUMA node placement of each folio, calculating the ratio of eligible memory on the specified node versus total eligible memory.
Quoted 6 lines
The implementation is guarded by
CONFIG_DAMON_PADDRsincedamon_get_folio()is only available when physical address space monitoring is enabled.
I think you don't need to add the Reported-by: and Closes: for bug that found before this patch is merged. Could you please drop those?
Quoted 6 lines
Signed-off-by Ravi Jonnalagadda <[email protected]>--- include/linux/damon.h | 6 ++ mm/damon/core.c | 186 ++++++++++++++++++++++++++++++++++++--- mm/damon/sysfs-schemes.c | 12 +++ 3 files changed, 190 insertions(+), 14 deletions(-)
[...]
The code changes look good to me. But, as I replied to the cover letter, I'd like to get sashiko review before giving my Reviewed-by:. Could you please rebase this to the latest mm-new and repost for getting the sashiko review?
Thanks,
SJ
SeongJae Park
maintainerHello Ravi,
Quoted 8 lines · On Fri, 3 Apr 2026 18:22:14 -0700 Ravi Jonnalagadda <[email protected]>…
This patch introduces two new DAMOS quota goal metrics for controlling memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring.
Changes since v4:
=================
https://lore.kernel.org/linux-mm/[email protected]/
Quoted 6 lines
- Fixed commit message description for
DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BPper review feedback
- Added clarifying comment forops-common.hinclude (fordamon_get_folio())
- Fixed build error whenCONFIG_DAMON_PADDRis disabled by adding #ifdefCONFIG_DAMON_PADDRguards around functions usingdamon_get_folio()
- Dropped RFC tag per maintainer feedback
Thank you for revisioning while addressing my comments on the previous version!
Quoted 2 lines
This patch is based on top of damon/next.
Maybe because of this, sashiko was unable to review this.
To my understanding, there is no real reason to make this based on damon/next. And I'd like to get sashiko review for this patch. Could you please rebase this to latest mm-new and repost for that?
Quoted 8 lines
Background and Motivation
=========================In heterogeneous memory systems, controlling memory distribution across NUMA nodes is essential for performance optimization. This patch enables system-wide page distribution with target-state goals such as "maintain 30% of scheme-eligible memory on CXL" using PA-mode DAMON schemes.
[...]
Other than the lack of the sashiko review, this cover letter looks good to me.
Thanks,
SJ
[...]