From: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: akpm@linux-foundation.org, corbet@lwn.net, bijan311@gmail.com,
ajayjoshi@micron.com, honggyu.kim@sk.com, yunjeong.mun@sk.com,
Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Subject: [RFC PATCH v2 0/3] mm/damon: Introduce node_target_mem_bp Quota Goal Metric
Date: Thu, 29 Jan 2026 13:58:11 -0800 [thread overview]
Message-ID: <20260129215814.1618-1-ravis.opensrc@gmail.com> (raw)
This series introduces a new DAMON quota goal metric, `node_target_mem_bp`,
designed for controlling memory migration in heterogeneous memory systems
(e.g., DRAM and CXL memory tiering).
v1: https://lore.kernel.org/linux-mm/20260123045733.6954-1-ravis.opensrc@gmail.com/T/#u
Changes since v1:
=================
- Renamed metric from `node_sys_bp` to `node_target_mem_bp` for consistency
with existing node-related quota goal metrics (node_mem_used_bp,
node_mem_free_bp) as suggested by SJ.
- Fixed the metric calculation:
* Numerator: Now correctly counts only scheme-eligible bytes (regions
matching the scheme's access pattern criteria).
* Denominator: Now uses node capacity instead of total system memory.
- Removed the get_goal_metric() ops callback. The implementation now
resides in core.c, following the existing pattern for other metrics
that have ops-layer dependencies.
- Removed the early-exit optimization patch. As SJ noted, this would
introduce a behavioral change for existing users and should be an
opt-in feature with a properly designed interface. This can be
addressed in a separate follow-up series.
- Removed capacity clamping logic (was tied to early-exit behavior).
Background and Motivation
=========================
A previous patch series [1] added weighted interleave support for DAMON
migrate_{hot,cold} actions for vaddr schemes. That approach requires VMA
offset information to determine target nodes, which for paddr schemes
would require costly rmap walks.
This series takes a different approach for PA-based migration control
using basis points (bp) target-state goals instead of weight-based
action rates, avoiding the need for rmap walks entirely.
What This Metric Does
=====================
The `node_target_mem_bp` metric measures:
scheme_eligible_bytes_on_node / node_capacity
expressed in basis points (bp, 1/10000).
"Scheme-eligible bytes" are regions that match the scheme's access pattern
criteria (size, nr_accesses, age). This allows users to specify goals like:
"Migrate hot pages until node N contains X% hot memory"
Unlike weight-based approaches that specify ACTION RATES, this metric
specifies a TARGET STATE, which naturally prevents oscillation issues
that would occur with weight-based PA migration without rmap.
Two-Context Setup for Hot Page Distribution
===========================================
For distributing hot pages between two NUMA nodes (e.g., DRAM node 0 and
CXL node 1), two DAMON contexts work together:
Context 0: monitors node 0, migrate_hot -> node 1
goal: node_target_mem_bp, nid=0, target=6000
"Migrate hot pages out when node 0 exceeds 60% hot"
Context 1: monitors node 1, migrate_hot -> node 0
goal: node_target_mem_bp, nid=1, target=4000
"Migrate hot pages out when node 1 exceeds 40% hot"
Each context migrates excess hot pages to the other node. The system
converges when both nodes reach their target hot memory ratios.
Complementary to Existing vaddr Migration
=========================================
This series complements rather than replaces the vaddr weighted interleave
migration:
vaddr migration (weight-based):
- Per-process control
- Fine-grained interleave patterns via VMA offset
- Deterministic placement based on weights
paddr migration (bp-based, this series):
- System-wide control
- Target-state goals for node capacity management
- No rmap overhead
Patch Organization
==================
1. mm/damon/core: add DAMOS_QUOTA_NODE_TARGET_MEM_BP metric
- Adds new enum value and documentation
2. mm/damon/core: implement NODE_TARGET_MEM_BP metric calculation
- Adds damos_get_node_target_mem_bp() function
- Updates function signatures to pass ctx and scheme through call chain
3. mm/damon/sysfs-schemes: expose NODE_TARGET_MEM_BP metric
- Exposes metric as 'node_target_mem_bp' in sysfs
Status
======
These patches have been compile-tested but have NOT been tested on actual
hardware. Feedback on the design and approach is appreciated.
References
==========
[1] mm/damon/vaddr: Allow interleaving in migrate_{hot,cold} actions
https://lore.kernel.org/linux-mm/20250709005952.17776-1-bijan311@gmail.com/
Ravi Jonnalagadda (3):
mm/damon/core: add DAMOS_QUOTA_NODE_TARGET_MEM_BP metric
mm/damon/core: implement NODE_TARGET_MEM_BP metric calculation
mm/damon/sysfs-schemes: expose NODE_TARGET_MEM_BP metric
include/linux/damon.h | 5 +++
mm/damon/core.c | 66 +++++++++++++++++++++++++++++++++++-----
mm/damon/sysfs-schemes.c | 5 +++
3 files changed, 69 insertions(+), 7 deletions(-)
--
2.43.0
next reply other threads:[~2026-01-29 21:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 21:58 Ravi Jonnalagadda [this message]
2026-01-29 21:58 ` [PATCH 1/3] mm/damon/core: add DAMOS_QUOTA_NODE_TARGET_MEM_BP metric Ravi Jonnalagadda
2026-01-30 1:49 ` SeongJae Park
2026-01-29 21:58 ` [PATCH 2/3] mm/damon/core: implement NODE_TARGET_MEM_BP metric calculation Ravi Jonnalagadda
2026-01-29 21:58 ` [PATCH 3/3] mm/damon/sysfs-schemes: expose NODE_TARGET_MEM_BP metric Ravi Jonnalagadda
2026-01-30 1:48 ` [RFC PATCH v2 0/3] mm/damon: Introduce node_target_mem_bp Quota Goal Metric SeongJae Park
2026-01-31 19:54 ` SeongJae Park
2026-02-03 19:48 ` Ravi Jonnalagadda
2026-02-04 0:28 ` SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260129215814.1618-1-ravis.opensrc@gmail.com \
--to=ravis.opensrc@gmail.com \
--cc=ajayjoshi@micron.com \
--cc=akpm@linux-foundation.org \
--cc=bijan311@gmail.com \
--cc=corbet@lwn.net \
--cc=damon@lists.linux.dev \
--cc=honggyu.kim@sk.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj@kernel.org \
--cc=yunjeong.mun@sk.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox