Skip to contentSkip to conversation

mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics

RFC PATCH Superseded Ravi Jonnalagadda 3 participants 9 messages Mar 20 – Mar 25

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics

This patch introduces two new DAMON quota goal metrics for controlling memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring.

v3: https://lore.kernel.org/linux-mm/[email protected]/

Changes since v3:
=================

- The first two patches from v3 (goal_tuner initialization fix and esz=0 quota bypass fix) are now in damon/next. This submission contains only the core metrics patch, rebased on top of those fixes.

- Simplified implementation: removed per-node eligible_bytes array, now iterates scheme-eligible regions directly for each goal evaluation.

- Handle regions crossing node boundaries: uses damon_get_folio() to determine actual NUMA node placement of each folio rather than assuming uniform node placement within a region.

- Pass scheme pointer directly to metric calculation functions, avoiding container_of() derivation from quota pointer.

- Fixed 80-column wrapping issues.

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 like "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

The metrics are complementary: eligible_bp + ineligible_bp = 10000 bp.

Two-Scheme Setup for Hot Page Distribution
==========================================

For maintaining 30% of hot memory on CXL (node 1):

    PUSH scheme: migrate_hot from node 0 -> node 1
      goal: node_ineligible_mem_bp, nid=0, target=3000
      "Push hot pages out until 30% of hot memory is NOT on DRAM"

    PULL scheme: migrate_hot from node 1 -> node 0
      goal: node_eligible_mem_bp, nid=0, target=7000
      "Pull hot pages back until 70% of hot memory IS on DRAM"

The complementary goals create a feedback loop that converges to the target distribution.

Dependencies
============

This patch is based on SJ's damon/next branch which includes the TEMPORAL goal tuner required for these metrics.

Testing Results
===============

Functionally tested on a two-node heterogeneous memory system with DRAM (node 0) and CXL memory (node 1). Used PUSH+PULL scheme configuration with migrate_hot action to maintain a target hot memory ratio between the two tiers.

With the TEMPORAL goal 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.

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          | 158 ++++++++++++++++++++++++++++++++++++---
 mm/damon/sysfs-schemes.c |  12 +++
 3 files changed, 164 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

RFC PATCH v4 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 eligible memory NOT 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.

---
 include/linux/damon.h    |   6 ++
 mm/damon/core.c          | 158 ++++++++++++++++++++++++++++++++++++---
 mm/damon/sysfs-schemes.c |  12 +++
 3 files changed, 164 insertions(+), 12 deletions(-)
include/linux/damon.h +6 -0
index b1d8fd88a0fc..490918804f85 100644
@@ -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 +146 -12

238 lines not on this page · raw message

mm/damon/sysfs-schemes.c +12 -0
index bf923709ab91..7e9cd19d5bff 100644
@@ -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
maintainer
#2 lore raw
Quoted 6 lines · On Fri, 20 Mar 2026 12:04:53 -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 eligible memory NOT on a node

The description for the second metric should be "ratio of ineligible memory on a node".

Quoted 47 lines

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.

---
 include/linux/damon.h    |   6 ++
 mm/damon/core.c          | 158 ++++++++++++++++++++++++++++++++++++---
 mm/damon/sysfs-schemes.c |  12 +++
 3 files changed, 164 insertions(+), 12 deletions(-)
include/linux/damon.h +6 -0
index b1d8fd88a0fc..490918804f85 100644
@@ -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 +0 -0
index b9e12865622c..3e0ac65e34a0 100644

mm/damon/core.c line 21

Quoted 5 lines
mm/damon/core.c +2 -0
@@ -17,6 +17,8 @@
 #include <linux/string.h>
 #include <linux/string_choices.h>
 
+#include "ops-common.h"
+

I don't find a reason to include this, and I'd like to avoid including that in core.c unless it is really necessary. Could you please remove this?

Below looks all good for RFC level code to move on to the next stage (dropping RFC tag). :)

Thanks,
SJ

[...]

#3 lore raw
Quoted 6 lines · SeongJae Park
Quoted 3 lines · On Fri, 20 Mar 2026 12:04:53 -0700 Ravi Jonnalagadda <[email protected]>…

Add new quota goal metrics for memory tiering that track scheme-eligible memory distribution across NUMA nodes:

Quoted 7 lines
Quoted 3 lines

- DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: ratio of eligible memory on a node
- DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP: ratio of eligible memory NOT on a node

The description for the second metric should be "ratio of ineligible memory on a node".

Got it. Will fix the commit message.

Quoted 50 lines
Quoted 50 lines

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.

---
 include/linux/damon.h    |   6 ++
 mm/damon/core.c          | 158 ++++++++++++++++++++++++++++++++++++---
 mm/damon/sysfs-schemes.c |  12 +++
 3 files changed, 164 insertions(+), 12 deletions(-)
include/linux/damon.h +6 -0
index b1d8fd88a0fc..490918804f85 100644
@@ -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 +0 -0
index b9e12865622c..3e0ac65e34a0 100644
@@ -17,6 +17,8 @@
 #include <linux/string.h>
 #include <linux/string_choices.h>
 
Quoted 6 lines

mm/damon/core.c line 21

Quoted 2 lines
mm/damon/core.c +2 -0
+#include "ops-common.h"
+

I don't find a reason to include this, and I'd like to avoid including that in core.c unless it is really necessary. Could you please remove this?

The include was added because the implementation uses damon_get_folio() to determine NUMA node placement of folios when iterating eligible regions. Would you prefer that I move the damon_get_folio() declaration to include/linux/damon.h, or would you suggest a different approach such as adding an ops callback for the node calculation?

Quoted 3 lines

Below looks all good for RFC level code to move on to the next stage (dropping RFC tag). :)

Thank you, SJ! Will send v5 with fixes once I hear back on the above.

Best Regards,
Ravi.

Quoted 5 lines

Thanks,
SJ

[...]

maintainer
#4 lore raw
Quoted 74 lines · On Mon, 23 Mar 2026 12:41:42 -0700 Ravi Jonnalagadda <[email protected]>…
Quoted 6 lines · SeongJae Park
Quoted 3 lines · On Fri, 20 Mar 2026 12:04:53 -0700 Ravi Jonnalagadda <[email protected]>…

Add new quota goal metrics for memory tiering that track scheme-eligible memory distribution across NUMA nodes:

Quoted 7 lines
Quoted 3 lines

- DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: ratio of eligible memory on a node
- DAMOS_QUOTA_NODE_INELIGIBLE_MEM_BP: ratio of eligible memory NOT on a node

The description for the second metric should be "ratio of ineligible memory on a node".

Got it. Will fix the commit message.

Quoted 50 lines
Quoted 50 lines

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.

---
 include/linux/damon.h    |   6 ++
 mm/damon/core.c          | 158 ++++++++++++++++++++++++++++++++++++---
 mm/damon/sysfs-schemes.c |  12 +++
 3 files changed, 164 insertions(+), 12 deletions(-)
include/linux/damon.h +6 -0
index b1d8fd88a0fc..490918804f85 100644
@@ -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 +0 -0
index b9e12865622c..3e0ac65e34a0 100644
@@ -17,6 +17,8 @@
 #include <linux/string.h>
 #include <linux/string_choices.h>
 
Quoted 6 lines

mm/damon/core.c line 21

Quoted 2 lines
mm/damon/core.c +2 -0
+#include "ops-common.h"
+

I don't find a reason to include this, and I'd like to avoid including that in core.c unless it is really necessary. Could you please remove this?

Quoted 2 lines

The include was added because the implementation uses damon_get_folio() to determine NUMA node placement of folios when iterating eligible regions.

Thank you for clarifying, Ravi.

Quoted 3 lines

Would you prefer that I move the damon_get_folio() declaration to include/linux/damon.h, or would you suggest a different approach such as adding an ops callback for the node calculation?

I'd like to keep it mm/damon/ internal if possible. Maybe adding new files, say, mm/damon/common.{c,h} is one option.

Just keeping it as is for now with clarification comment (e.g., "including ops-common.h for damon_get_folio()") for now, and revisiting for cleanup in future could also be another option.

I slightly prefer the second option at the moment.

Quoted 6 lines
Quoted 4 lines

Below looks all good for RFC level code to move on to the next stage (dropping RFC tag). :)

Thank you, SJ! Will send v5 with fixes once I hear back on the above.

Sounds good, looking forward to!

Thanks,
SJ

[...]

#5 lore raw
In reply to Ravi Jonnalagadda
kernel test robot noticed the following build errors:

Hi Ravi,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on sj/damon/next]
[cannot apply to akpm-mm/mm-everything linus/master v7.0-rc5 next-20260324] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ravi-Jonnalagadda/mm-damon-add-node_eligible_mem_bp-and-node_ineligible_mem_bp-goal-metrics/20260322-011937
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sj/linux.git damon/next
patch link:    https://lore.kernel.org/r/20260320190453.1430-2-ravis.opensrc%40gmail.com
patch subject: [RFC PATCH v4 1/1] mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics
config: arm64-randconfig-r123-20260325 (https://download.01.org/0day-ci/archive/20260325/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260325/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: damon_get_folio
   >>> referenced by core.c
   >>>               mm/damon/core.o:(damos_calc_eligible_bytes) in archive vmlinux.a
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#6 lore raw
In reply to Ravi Jonnalagadda

Hello Ravi,

Thank you for this patch! TL; DR: Other than trivial things I commented below and to the patch, I believe it is time to drop the RFC tag, and work on merging this.

Quoted 1 line · On Fri, 20 Mar 2026 12:04:52 -0700 Ravi Jonnalagadda <[email protected]>…

This patch introduces two new DAMON quota goal metrics for controlling

s/DAMON/DAMOS/ ?

Quoted 4 lines

memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring.

v3: https://lore.kernel.org/linux-mm/[email protected]/

The above link would better to be put on 'Chage since v3' section below.

Quoted 6 lines

Changes since v3:
=================

- The first two patches from v3 (goal_tuner initialization fix and esz=0 quota bypass fix) are now in damon/next. This submission

It is not also in mm-unstable :)

Quoted 5 lines

contains only the core metrics patch, rebased on top of those fixes.

- Simplified implementation: removed per-node eligible_bytes array, now iterates scheme-eligible regions directly for each goal evaluation.

Quoted 8 lines

- Handle regions crossing node boundaries: uses damon_get_folio() to determine actual NUMA node placement of each folio rather than assuming uniform node placement within a region.

- Pass scheme pointer directly to metric calculation functions, avoiding container_of() derivation from quota pointer.

- Fixed 80-column wrapping issues.

Thank you for addressing all my comments!

Quoted 16 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 like "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:

Quoted 8 lines
    (total - scheme_eligible_bytes_on_node) / total * 10000

The metrics are complementary: eligible_bp + ineligible_bp = 10000 bp.

Two-Scheme Setup for Hot Page Distribution
==========================================

For maintaining 30% of hot memory on CXL (node 1):

I think it could help easy reading if the above sentence also explains node 0 is DRAM. For example,

For maintaining hot memory on DRAM (node 0) and CXL (node 1) in 7:3 ratio:

Quoted 4 lines
    PUSH scheme: migrate_hot from node 0 -> node 1
      goal: node_ineligible_mem_bp, nid=0, target=3000
      "Push hot pages out until 30% of hot memory is NOT on DRAM"

Seems the sentence assumes the actor is in DRAM. It was not very clear to me. How about making it clear? E.g.,

"Move hot pages from DRAM to CXL, if more than 70% of hot data is in DRAM"

Quoted 4 lines
    PULL scheme: migrate_hot from node 1 -> node 0
      goal: node_eligible_mem_bp, nid=0, target=7000
      "Pull hot pages back until 70% of hot memory IS on DRAM"

If the above example is good for you, to be consistent with it, how about rewording like below?

"Move hot pages from CXL to DRAM, if less than 70% of hot data is in DRAM"

Quoted 9 lines

The complementary goals create a feedback loop that converges to the target distribution.

Dependencies
============

This patch is based on SJ's damon/next branch which includes the TEMPORAL goal tuner required for these metrics.

Your test might be depend on the feature. But this patch series itself is not, as users could also use it with CONSIST tuner?

Also, as I mentioned above, the feature is now also in mm-unstable tree.

Quoted 9 lines

Testing Results
===============

Functionally tested on a two-node heterogeneous memory system with DRAM (node 0) and CXL memory (node 1). Used PUSH+PULL scheme configuration with migrate_hot action to maintain a target hot memory ratio between the two tiers.

Quoted 8 lines

With the TEMPORAL goal 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.

Sounds reasonable!

Do you plan to further evaluate some performance metrics? I'd not strongly request that, but it would be very nice if we can have that.

Regardless of your answer to the above question, I think the current code and the test is good enough to consider merging this. I suggest dropping the RFC tag from the next spin.

Thank you for doing this, Ravi!

Thanks,
SJ

[...]

#7 lore raw
Quoted 8 lines · SeongJae Park

Hello Ravi,

Thank you for this patch! TL; DR: Other than trivial things I commented below and to the patch, I believe it is time to drop the RFC tag, and work on merging this.

Thanks, SJ, for the prompt and detailed feedback!

Quoted 6 lines · On Fri, 20 Mar 2026 12:04:52 -0700 Ravi Jonnalagadda <[email protected]>…
Quoted 2 lines

This patch introduces two new DAMON quota goal metrics for controlling

s/DAMON/DAMOS/ ?

Will fix it.

Quoted 7 lines
Quoted 4 lines

memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring.

v3: https://lore.kernel.org/linux-mm/[email protected]/

The above link would better to be put on 'Chage since v3' section below.

Got it. Will take care of it next time.

Quoted 8 lines
Quoted 6 lines

Changes since v3:
=================

- The first two patches from v3 (goal_tuner initialization fix and esz=0 quota bypass fix) are now in damon/next. This submission

It is not also in mm-unstable :)

Good to know. Will mention this in the next version.

Quoted 40 lines
Quoted 6 lines

contains only the core metrics patch, rebased on top of those fixes.

- Simplified implementation: removed per-node eligible_bytes array, now iterates scheme-eligible regions directly for each goal evaluation.

Quoted 8 lines

- Handle regions crossing node boundaries: uses damon_get_folio() to determine actual NUMA node placement of each folio rather than assuming uniform node placement within a region.

- Pass scheme pointer directly to metric calculation functions, avoiding container_of() derivation from quota pointer.

- Fixed 80-column wrapping issues.

Thank you for addressing all my comments!

Quoted 23 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 like "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

The metrics are complementary: eligible_bp + ineligible_bp = 10000 bp.

Two-Scheme Setup for Hot Page Distribution
==========================================

Quoted 6 lines
Quoted 1 line

For maintaining 30% of hot memory on CXL (node 1):

I think it could help easy reading if the above sentence also explains node 0 is DRAM. For example,

For maintaining hot memory on DRAM (node 0) and CXL (node 1) in 7:3 ratio:

Good suggestion, will clarify the node mapping.

Quoted 10 lines
Quoted 5 lines

    PUSH scheme: migrate_hot from node 0 -> node 1
      goal: node_ineligible_mem_bp, nid=0, target=3000
      "Push hot pages out until 30% of hot memory is NOT on DRAM"

Seems the sentence assumes the actor is in DRAM. It was not very clear to me. How about making it clear? E.g.,

"Move hot pages from DRAM to CXL, if more than 70% of hot data is in DRAM"

Got it. Will use your suggested wording.

Quoted 10 lines
Quoted 5 lines

    PULL scheme: migrate_hot from node 1 -> node 0
      goal: node_eligible_mem_bp, nid=0, target=7000
      "Pull hot pages back until 70% of hot memory IS on DRAM"

If the above example is good for you, to be consistent with it, how about rewording like below?

"Move hot pages from CXL to DRAM, if less than 70% of hot data is in DRAM"

Agreed. Will reword this too.

Quoted 5 lines
Quoted 5 lines

The complementary goals create a feedback loop that converges to the target distribution.

Quoted 9 lines
Quoted 5 lines

Dependencies
============

This patch is based on SJ's damon/next branch which includes the TEMPORAL goal tuner required for these metrics.

Your test might be depend on the feature. But this patch series itself is not, as users could also use it with CONSIST tuner?

Correct, the metrics work with both tuners. Will reword to clarify that testing used TEMPORAL but the patch itself does not depend on it.

Quoted 16 lines

Also, as I mentioned above, the feature is now also in mm-unstable tree.

Quoted 14 lines

Testing Results
===============

Functionally tested on a two-node heterogeneous memory system with DRAM (node 0) and CXL memory (node 1). Used PUSH+PULL scheme configuration with migrate_hot action to maintain a target hot memory ratio between the two tiers.

With the TEMPORAL goal 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.

Quoted 9 lines
Quoted 3 lines

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.

Sounds reasonable!

Do you plan to further evaluate some performance metrics? I'd not strongly request that, but it would be very nice if we can have that.

Yes, I am planning to run additional tests. I will send v5 addressing all the review comments and dropping the RFC tag. Results will follow as the testing progresses.

Quoted 6 lines

Regardless of your answer to the above question, I think the current code and the test is good enough to consider merging this. I suggest dropping the RFC tag from the next spin.

Thank you for doing this, Ravi!

Thank you! Will drop the RFC tag for v5.

Quoted 4 lines

Thanks,
SJ

Best Regards,
Ravi.

Quoted 1 line

[...]

maintainer
#8 lore raw
Quoted 1 line · On Mon, 23 Mar 2026 12:23:49 -0700 Ravi Jonnalagadda <[email protected]>…

On Sat, Mar 21, 2026 at 9:57 AM SeongJae Park <[email protected]> wrote:

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

Changes since v3:
=================

- The first two patches from v3 (goal_tuner initialization fix and esz=0 quota bypass fix) are now in damon/next. This submission

It is not also in mm-unstable :)

What I really wanted to say is, s/not/now/

Quoted 2 lines

Good to know. Will mention this in the next version.

I think Ravi understood what I really wanted to mean, though.

[...]

Quoted 1 line

Thank you! Will drop the RFC tag for v5.

Looking forward to!

Thanks,
SJ

[...]