[RFC PATCH 6/7] mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check

From: Ravi Jonnalagadda

Date: Sat May 16 2026 - 18:36:46 EST


damos_get_node_eligible_mem_bp() and the damon_commit_ctx() validation
path reject any ops.id != DAMON_OPS_PADDR, which caused paddr_ibs to
always get 0 from the node-eligible helper. This caused the quota
control loop to run open-loop (esz doubles every tick) when using the
paddr_ibs backend with a node_eligible_mem_bp goal.

Introduce damon_ops_id_is_paddr_family() and use it at both sites so
DAMON_OPS_PADDR_IBS is accepted alongside DAMON_OPS_PADDR. The helper
also gives any future paddr-family backend a single line to extend.

Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@xxxxxxxxx>
---
mm/damon/core.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 2aa031cbc70b7..1e52161f4c015 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -83,6 +83,16 @@ static bool damon_ops_is_hw_hotness(enum damon_ops_id id)
return id == DAMON_OPS_PADDR_IBS;
}

+/*
+ * Returns true if the ops id treats the monitoring target as a
+ * physical-address region (no per-task PID). Used by paddr-only
+ * gates such as node_eligible_mem_bp.
+ */
+static bool damon_ops_id_is_paddr_family(enum damon_ops_id id)
+{
+ return id == DAMON_OPS_PADDR || id == DAMON_OPS_PADDR_IBS;
+}
+
/**
* damon_is_registered_ops() - Check if a given damon_operations is registered.
* @id: Id of the damon_operations to check if registered.
@@ -1787,8 +1797,8 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)
if (!is_power_of_2(src->min_region_sz))
return -EINVAL;

- /* node_eligible_mem_bp metric requires PADDR ops */
- if (src->ops.id != DAMON_OPS_PADDR) {
+ /* node_eligible_mem_bp metric requires PADDR-family ops */
+ if (!damon_ops_id_is_paddr_family(src->ops.id)) {
damon_for_each_scheme(scheme, src) {
struct damos_quota *quota = &scheme->quota;

@@ -3041,7 +3051,7 @@ static unsigned long damos_get_node_eligible_mem_bp(struct damon_ctx *c,
phys_addr_t total_eligible = 0;
phys_addr_t node_eligible;

- if (c->ops.id != DAMON_OPS_PADDR)
+ if (!damon_ops_id_is_paddr_family(c->ops.id))
return 0;

if (nid < 0 || nid >= MAX_NUMNODES || !node_online(nid))
--
2.43.0