* [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example
@ 2026-05-16 22:34 Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 1/7] mm/damon/core: refcount ops owner module to prevent rmmod UAF Ravi Jonnalagadda
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
Hi all,
This is an RFC, not for merge. The series exercises and validates
damon_report_access() -- the consumer API SeongJae introduced in [1]
-- as a substrate for ingesting access reports from hardware-sampling
sources. The series includes one worked-example backend, an AMD IBS
Op module (damon_ibs.ko), that runs on Zen 3+ silicon via the
existing perf event subsystem.
Combined with node_eligible_mem_bp [2], the recently-merged DAMOS goal
metric, the same DAMON interface composes naturally for two
operational regimes from one set of primitives:
1. Traditional tiering -- promote hot pages to DRAM up to a target
cap.
2. System-wide bandwidth interleaving -- split hot pages between
DRAM and CXL at an operator-chosen ratio, for workloads where
placing some hot pages on CXL improves aggregate throughput.
Either regime composes with a separately-configured migrate_cold
scheme to pair bandwidth shaping with capacity expansion: the
hot-page schemes drive placement to meet the bandwidth target while
migrate_cold reclaims DRAM by demoting cold pages.
The demonstration in this RFC exercises different
target ratios of the same PULL+PUSH setup.
Why a hardware-source primitive complements existing primitives
===============================================================
DAMON's existing access-check primitives observe access through
software paths:
- PTE-Accessed bit scanning samples Accessed bits and clears them
periodically. The hardware sets PTE-A on TLB miss, so already-
resident TLB entries do not re-set the bit until they're evicted.
For pages whose translations stay TLB-resident across DAMON's
aggregation interval, nr_accesses reflects fewer accesses than
the page actually serviced. This is correct behaviour for the
primitive -- it observes what the TLB-miss path observes.
- Page-fault sampling (NUMA hint faults) requires unmapping pages
to provoke the fault, then samples access on the fault path.
For closed-loop schemes that drive migrate_hot from the same
observations, the unmap and the migrate action interact.
Both primitives produce a view of hotness that converges to the
true distribution over the aggregation interval. For systems where
the address space is small relative to the aggregation rate, this is
the right tool. On large heterogeneous-memory systems with goal-
driven schemes asking the closed-loop tuner to converge on a target
distribution, a complementary lower-latency view of accesses can
tighten the loop -- reducing the time DAMON's nr_accesses takes to
reflect the workload's actual access distribution, which in turn
reduces ramp duration and oscillation amplitude during convergence
of goal-driven schemes.
A hardware-sampling primitive provides this complementary view:
hardware retirement records each access at its natural event rate,
with a physical address per sample, independent of TLB state and
independent of the unmap/fault path.
This RFC adds the substrate (damon_report_access) so any hardware
sampler -- IBS, PEBS, future CXL hotness monitoring units --
can feed access reports into the kdamond drain path and existing
DAMOS schemes. The substrate is the contribution; the IBS backend
is one worked example proving it on broadly-available silicon today.
Demonstration
=============
The two-scheme PULL+PUSH setup from the node_eligible_mem_bp
introduction holds a target hot-memory ratio across DRAM and CXL.
With damon_ibs.ko feeding damon_report_access, we observe two
operational regimes:
Cold-start convergence -- workload starts at an even DRAM/CXL
distribution (numactl --interleave=DRAM,CXL), DAMON context starts
with the target ratio set at kdamond launch, schemes converge from
the initial distribution to the target distribution.
+-----------+--------+----------+---------+
| Target | Mean | Offset | Stddev |
+-----------+--------+----------+---------+
| 70% DRAM | 69.73% | -0.27pp | 0.70pp |
| 30% DRAM | 31.00% | +1.00pp | 1.28pp |
+-----------+--------+----------+---------+
Live target changes from a converged state -- kdamond context runs
continuously, target ratio updated via DAMOS commit_schemes_quota_goals
without kdamond teardown.
+-----------+--------+----------+---------+
| Target | Mean | Offset | Stddev |
+-----------+--------+----------+---------+
| 90% DRAM | 89.74% | -0.26pp | 0.64pp |
| 85% DRAM | 84.61% | -0.39pp | 0.60pp |
+-----------+--------+----------+---------+
In both regimes, convergence to target is quick, and the workload's
measured DRAM share then holds within 1.3 percentage points of
target with standard deviation under 1.3 percentage points, sustained
over runs of 15-30 minutes per target.
Hardware envelope: AMD EPYC dual-socket, CXL.mem on a separate NUMA
node, 32GB hot working set, two migrate_hot schemes with complementary
address filters, temporal quota tuner, 256-entry per-CPU report ring,
512 MiB per-scheme quota, 1s reset interval.
What's in this series
=====================
Patch 1. mm/damon/core: refcount ops owner module to prevent
rmmod UAF
Patch 2. mm/damon/paddr: export damon_pa_* ops for IBS module
Patch 3. mm/damon/core: replace mutex-protected report buffer
with per-CPU lockless ring
Patch 4. mm/damon/core: flat-array snapshot + bsearch in ring-
drain loop
Patch 5. mm/damon: add sysfs binding and dispatch hookup for
paddr_ibs operations
Patch 6. mm/damon/core: accept paddr_ibs in node_eligible_mem_bp
ops check
Patch 7. mm/damon/damon_ibs: add AMD IBS-based access sampling
backend
Patches 1, 3, and 4 are general infrastructure that benefits any
consumer of damon_report_access(). Patches 2, 5, 6, and 7 are the
worked-example backend (paddr_ibs ops, sysfs binding, IBS module).
Patches worth folding into damon/next
=====================================
Patches 1, 3, and 4 are not specific to IBS or to this RFC's
backend. Each is preparatory infrastructure that any consumer of
damon_report_access() will need:
- Patch 1 (refcount ops owner) -- any modular ops set, including
out-of-tree backends, needs clean module unload to avoid UAF
on damon_unregister_ops.
- Patch 3 (per-CPU lockless ring) -- damon_report_access() cannot
be called from NMI context with the current mutex-protected
buffer. Hardware samplers all need NMI-safe submission.
- Patch 4 (flat-array snapshot + bsearch drain) -- the linear-
scan drain is O(reports x regions) and exceeds the sample
interval at high-CPU x large-region products. Bsearch brings
it to O(reports x log regions).
If these belong directly on damon/next as preparatory patches for
damon_report_access() rather than living inside an IBS-specific
track, we are happy to rebase and resend them that way.
Relation to prior and ongoing work
==================================
The IBS sampling pattern in patch 7 -- attr.config=0 to use IBS Op
default config, dc_phy_addr_valid filter, NMI-safe sample submission
-- is derived from concepts in Bharata B Rao's pghot RFC v5 [3].
The attribution header is in mm/damon/damon_ibs.c and the patch
carries a Suggested-by: trailer.
Bharata's pghot v7 [4] introduces a different IBS driver targeting
the new IBS Memory Profiler (IBS-MProf) facility, which Bharata
describes as a facility "that will be present in future AMD
processors" -- a separate IBS instance from the one this RFC's
backend uses. This version of driver based out of v5 [3] is an
example of how DAMON can be benefited from AMD IBS Hardware
source and validates importance of IBS information indepedently.
It is not meant to be merged in the current form.
@Bharata if you see a path where IBS samples can be consumed
by DAMON at some point, will be happy to collaborate.
Akinobu Mita's perf-event-based access-check RFC [5] explores a
configurable perf-event-driven access source for DAMON. IBS has
vendor-specific MSR setup beyond what perf_event_attr alone
expresses (e.g. dc_phy_addr_valid filtering on the produced sample,
not on the perf attr), so the IBS path here appears complementary
to [5] -- operators choose based on whether their hardware sampler
fits stock perf or needs additional kernel-side setup.
Specific asks
=============
To SeongJae:
1. Patches 1, 3, and 4 are infrastructure that benefits any consumer
of damon_report_access(), not just the IBS backend in this RFC.
Would these belong directly on damon/next as preparatory patches
for damon_report_access(), rather than living inside an
IBS-specific track? Happy to rebase and resend them that way if
you'd prefer that shape. Tested-by: tags can come along.
Future work
===========
- Longer-duration stability and broader workload coverage.
Test branch
===========
A single fetch reproduces the cover-letter measurements on top of
both this RFC and the companion DAMOS quota controller and paddr
migration walk fixes posted separately at [6]:
git fetch https://github.com/ravis-opensrc/linux.git \
damon/hw-hotness-rfc-v1-testing
The companion fixes are not required for this RFC to function, but
the closed-loop measurements above were collected on the testing
branch which has both applied. The standalone series-only branches
are also available:
git fetch https://github.com/ravis-opensrc/linux.git \
damon/hw-hotness-rfc-v1
git fetch https://github.com/ravis-opensrc/linux.git \
damon/closed-loop-fixes-v1
Links
=====
[1] [RFC PATCH v3 00/37] mm/damon: introduce per-CPUs/threads/
write/read monitoring (SeongJae Park)
https://lore.kernel.org/linux-mm/20251208062943.68824-1-sj@kernel.org/
Patch 01 introduces damon_report_access(), the consumer API
this RFC builds on.
[2] mm/damon: add node_eligible_mem_bp goal metric
https://lore.kernel.org/linux-mm/20260428030520.701-1-ravis.opensrc@gmail.com/
[3] [RFC PATCH v5 00/10] mm: Hot page tracking and promotion
infrastructure (Bharata B Rao)
https://lore.kernel.org/linux-mm/20260129144043.231636-1-bharata@amd.com/
[4] [PATCH v7 0/7] mm: Hot page tracking and promotion
infrastructure (Bharata B Rao)
https://lore.kernel.org/linux-mm/20260504060924.344313-1-bharata@amd.com/
[5] [RFC PATCH v3 0/4] mm/damon: introduce perf event based access
check (Akinobu Mita)
https://lore.kernel.org/linux-mm/20260423004211.7037-1-akinobu.mita@gmail.com/
[6] [PATCH 0/5] mm/damon: DAMOS quota controller and paddr
migration walk fixes (Ravi Jonnalagadda)
https://lore.kernel.org/linux-mm/20260516210357.2247-1-ravis.opensrc@gmail.com/
Ravi Jonnalagadda (7):
mm/damon/core: refcount ops owner module to prevent rmmod UAF
mm/damon/paddr: export damon_pa_* ops for IBS module
mm/damon/core: replace mutex-protected report buffer with per-CPU
lockless ring
mm/damon/core: flat-array snapshot + bsearch in ring-drain loop
mm/damon: add sysfs binding and dispatch hookup for paddr_ibs
operations
mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check
mm/damon/damon_ibs: add AMD IBS-based access sampling backend
include/linux/damon.h | 13 ++
mm/damon/Kconfig | 10 +
mm/damon/Makefile | 1 +
mm/damon/core.c | 341 +++++++++++++++++++++++++++------
mm/damon/damon_ibs.c | 369 ++++++++++++++++++++++++++++++++++++
mm/damon/ops-common.h | 13 ++
mm/damon/paddr.c | 15 +-
mm/damon/sysfs.c | 12 +-
mm/damon/tests/core-kunit.h | 2 +-
9 files changed, 707 insertions(+), 69 deletions(-)
create mode 100644 mm/damon/damon_ibs.c
base-commit: 606bfbf72120df4f406ef46971d48053706f6f75
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC PATCH 1/7] mm/damon/core: refcount ops owner module to prevent rmmod UAF
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 2/7] mm/damon/paddr: export damon_pa_* ops for IBS module Ravi Jonnalagadda
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
damon_select_ops() copies the registered damon_operations struct into
ctx->ops by value. After damon_unregister_ops() is called from a
backend module's exit path, the registry slot is cleared but any
surviving ctx still holds function pointers that resolve into the
unloaded module's text. Restarting kdamond on such a ctx, or invoking
any ops callback, jumps into freed code.
Add a struct module *owner field to damon_operations. In
damon_select_ops(), take a reference to ops->owner via try_module_get()
after locating the registry entry; on failure return -EBUSY without
binding the ctx. If the ctx already had an ops bound (re-select
case), drop the previous owner's reference before installing the new
one to keep the refcount balanced. In damon_destroy_ctx(), release
the reference via module_put(ctx->ops.owner).
In damon_commit_ctx(), the live ops field is overwritten by a value
copy from src. Balance the refcount when the owner changes: take a
ref on the new owner (return -EBUSY on failure) and put the ref on the
old owner before the assignment.
Built-in ops sets (vaddr, paddr) leave owner = NULL; try_module_get(NULL)
returns true and module_put(NULL) is a no-op. Loadable backends set
owner = THIS_MODULE in their registration.
Also add damon_unregister_ops() so loadable backends have a clean exit
path.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
include/linux/damon.h | 4 ++++
mm/damon/core.c | 46 ++++++++++++++++++++++++++++++++++---
mm/damon/tests/core-kunit.h | 2 +-
3 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index df7910a39b407..8e6e1cd89e551 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -682,6 +682,8 @@ enum damon_ops_id {
* struct damon_operations - Monitoring operations for given use cases.
*
* @id: Identifier of this operations set.
+ * @owner: Module that provides this operations set, or NULL
+ * for built-in ops.
* @init: Initialize operations-related data structures.
* @update: Update operations-related data structures.
* @prepare_access_checks: Prepare next access check of target regions.
@@ -728,6 +730,7 @@ enum damon_ops_id {
*/
struct damon_operations {
enum damon_ops_id id;
+ struct module *owner;
void (*init)(struct damon_ctx *context);
void (*update)(struct damon_ctx *context);
void (*prepare_access_checks)(struct damon_ctx *context);
@@ -1206,6 +1209,7 @@ int damon_commit_ctx(struct damon_ctx *old_ctx, struct damon_ctx *new_ctx);
int damon_nr_running_ctxs(void);
bool damon_is_registered_ops(enum damon_ops_id id);
int damon_register_ops(struct damon_operations *ops);
+int damon_unregister_ops(enum damon_ops_id id);
int damon_select_ops(struct damon_ctx *ctx, enum damon_ops_id id);
static inline bool damon_target_has_pid(const struct damon_ctx *ctx)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index e4b9adc0a64dd..b605d36b29b1a 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -12,6 +12,7 @@
#include <linux/kthread.h>
#include <linux/memcontrol.h>
#include <linux/mm.h>
+#include <linux/module.h>
#include <linux/psi.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -93,6 +94,31 @@ int damon_register_ops(struct damon_operations *ops)
mutex_unlock(&damon_ops_lock);
return err;
}
+EXPORT_SYMBOL_GPL(damon_register_ops);
+
+/**
+ * damon_unregister_ops() - Unregister a monitoring operations set.
+ * @id: ID of the operations set to unregister.
+ *
+ * Return: 0 on success, negative error code otherwise.
+ */
+int damon_unregister_ops(enum damon_ops_id id)
+{
+ if (id >= NR_DAMON_OPS)
+ return -EINVAL;
+
+ /*
+ * Callers (typically the owning module exit path) hold a
+ * module ref via try_module_get() in damon_select_ops(); the
+ * unregister cannot race with active ctxs because module_exit
+ * runs only at owner refcount 0.
+ */
+ mutex_lock(&damon_ops_lock);
+ memset(&damon_registered_ops[id], 0, sizeof(damon_registered_ops[id]));
+ mutex_unlock(&damon_ops_lock);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(damon_unregister_ops);
/**
* damon_select_ops() - Select a monitoring operations to use with the context.
@@ -112,10 +138,18 @@ int damon_select_ops(struct damon_ctx *ctx, enum damon_ops_id id)
return -EINVAL;
mutex_lock(&damon_ops_lock);
- if (!__damon_is_registered_ops(id))
+ if (!__damon_is_registered_ops(id)) {
err = -EINVAL;
- else
- ctx->ops = damon_registered_ops[id];
+ goto out;
+ }
+ if (!try_module_get(damon_registered_ops[id].owner)) {
+ err = -EBUSY;
+ goto out;
+ }
+ /* Drop previous owner ref if this ctx had ops selected before. */
+ module_put(ctx->ops.owner);
+ ctx->ops = damon_registered_ops[id];
+out:
mutex_unlock(&damon_ops_lock);
return err;
}
@@ -835,6 +869,7 @@ void damon_destroy_ctx(struct damon_ctx *ctx)
damon_for_each_sample_filter_safe(f, next_f, &ctx->sample_control)
damon_destroy_sample_filter(f, &ctx->sample_control);
+ module_put(ctx->ops.owner);
kfree(ctx);
}
@@ -1749,6 +1784,11 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)
return err;
}
dst->pause = src->pause;
+ if (src->ops.owner != dst->ops.owner) {
+ if (!try_module_get(src->ops.owner))
+ return -EBUSY;
+ module_put(dst->ops.owner);
+ }
dst->ops = src->ops;
err = damon_commit_probes(dst, src);
if (err)
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 0369c717b93db..300659b115602 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -342,7 +342,7 @@ static void damon_test_split_regions_of(struct kunit *test)
static void damon_test_ops_registration(struct kunit *test)
{
struct damon_ctx *c = damon_new_ctx();
- struct damon_operations ops = {.id = DAMON_OPS_VADDR}, bak;
+ struct damon_operations ops = {.id = DAMON_OPS_VADDR}, bak = {};
bool need_cleanup = false;
if (!c)
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 2/7] mm/damon/paddr: export damon_pa_* ops for IBS module
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 1/7] mm/damon/core: refcount ops owner module to prevent rmmod UAF Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 3/7] mm/damon/core: replace mutex-protected report buffer with per-CPU lockless ring Ravi Jonnalagadda
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
Remove static qualifier from damon_pa_prepare_access_checks,
damon_pa_check_accesses, damon_pa_apply_probes, damon_pa_apply_scheme,
and damon_pa_scheme_score. Add EXPORT_SYMBOL_GPL for each.
These functions are used as ops callbacks by the IBS backend module (damon_ibs.ko)
which registers paddr_ibs operations.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
mm/damon/ops-common.h | 13 +++++++++++++
mm/damon/paddr.c | 15 ++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/mm/damon/ops-common.h b/mm/damon/ops-common.h
index 5efa5b5970def..0ec75276d985a 100644
--- a/mm/damon/ops-common.h
+++ b/mm/damon/ops-common.h
@@ -23,3 +23,16 @@ bool damos_folio_filter_match(struct damos_filter *filter, struct folio *folio);
unsigned long damon_migrate_pages(struct list_head *folio_list, int target_nid);
bool damos_ops_has_filter(struct damos *s);
+
+/*
+ * paddr ops callbacks, declared here so paddr-family backends
+ * (e.g. paddr_ibs) can reuse the paddr operation implementations.
+ */
+void damon_pa_prepare_access_checks(struct damon_ctx *ctx);
+unsigned int damon_pa_check_accesses(struct damon_ctx *ctx);
+void damon_pa_apply_probes(struct damon_ctx *ctx);
+unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
+ struct damon_target *t, struct damon_region *r,
+ struct damos *scheme, unsigned long *sz_filter_passed);
+int damon_pa_scheme_score(struct damon_ctx *context,
+ struct damon_region *r, struct damos *scheme);
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index fc2154b6221fb..5af4ac2a7ed4d 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -124,13 +124,14 @@ static void damon_pa_prepare_access_checks_faults(struct damon_ctx *ctx)
}
}
-static void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
+void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
{
if (ctx->sample_control.primitives_enabled.page_table)
damon_pa_prepare_access_checks_abit(ctx);
if (ctx->sample_control.primitives_enabled.page_fault)
damon_pa_prepare_access_checks_faults(ctx);
}
+EXPORT_SYMBOL_GPL(damon_pa_prepare_access_checks);
static bool damon_pa_young(phys_addr_t paddr, unsigned long *folio_sz)
{
@@ -168,7 +169,7 @@ static void __damon_pa_check_access(struct damon_region *r,
last_addr = sampling_addr;
}
-static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
+unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
{
struct damon_target *t;
struct damon_region *r;
@@ -184,6 +185,7 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
return max_nr_accesses;
}
+EXPORT_SYMBOL_GPL(damon_pa_check_accesses);
static bool damon_pa_filter_match(struct damon_filter *filter,
struct folio *folio)
@@ -234,7 +236,7 @@ static bool damon_pa_filter_pass(phys_addr_t pa, struct folio *folio,
return pass;
}
-static void damon_pa_apply_probes(struct damon_ctx *ctx)
+void damon_pa_apply_probes(struct damon_ctx *ctx)
{
struct damon_target *t;
struct damon_region *r;
@@ -259,6 +261,7 @@ static void damon_pa_apply_probes(struct damon_ctx *ctx)
}
}
}
+EXPORT_SYMBOL_GPL(damon_pa_apply_probes);
/*
* damos_pa_filter_out - Return true if the page should be filtered out.
@@ -542,7 +545,7 @@ static unsigned long damon_pa_alloc_or_free(
#endif
-static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
+unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
struct damos *scheme, unsigned long *sz_filter_passed)
{
@@ -574,8 +577,9 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
}
return 0;
}
+EXPORT_SYMBOL_GPL(damon_pa_apply_scheme);
-static int damon_pa_scheme_score(struct damon_ctx *context,
+int damon_pa_scheme_score(struct damon_ctx *context,
struct damon_region *r, struct damos *scheme)
{
switch (scheme->action) {
@@ -595,6 +599,7 @@ static int damon_pa_scheme_score(struct damon_ctx *context,
return DAMOS_MAX_SCORE;
}
+EXPORT_SYMBOL_GPL(damon_pa_scheme_score);
static int __init damon_pa_initcall(void)
{
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 3/7] mm/damon/core: replace mutex-protected report buffer with per-CPU lockless ring
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 1/7] mm/damon/core: refcount ops owner module to prevent rmmod UAF Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 2/7] mm/damon/paddr: export damon_pa_* ops for IBS module Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 4/7] mm/damon/core: flat-array snapshot + bsearch in ring-drain loop Ravi Jonnalagadda
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
Replace the mutex-protected fixed-size array (DAMON_ACCESS_REPORTS_CAP=1000)
with a per-CPU lockless ring buffer. This enables damon_report_access()
to be called from NMI context.
Ring design:
- Producer is serialized per CPU: only one in-flight producer per CPU
is allowed. A per-CPU damon_report_ring_busy counter detects
NMI-on-process nesting and drops the nested attempt, preserving the
single-writer invariant on the slot.
- head is advanced by the producer with smp_wmb() before publish.
- tail is advanced by the consumer (kdamond) after the entries[] reads.
- Overflow: sample silently dropped. NMI context is allocation-free
and access reports are best-effort.
To keep the producer/consumer pattern scalable on systems with many
CPUs and a high NMI rate, the ring layout follows three rules:
- head, tail and entries[] live on separate cache lines via
____cacheline_aligned_in_smp, so producer and consumer do not
invalidate each other's working set on every advance.
- DAMON_REPORT_RING_SIZE is bounded so the per-CPU footprint stays
small (256 entries x sizeof(struct damon_access_report) plus head
and tail cache lines), keeping draining all rings during one
kdamond tick from evicting unrelated data on contemporary server
parts.
- A cpumask, damon_rings_pending, is set by the producer after
publishing and cleared by the consumer per ring drained, so the
consumer iterates only CPUs with pending entries instead of
walking every online CPU. An smp_mb__before_atomic() between the
head publish and the cpumask_set_cpu() ensures observers of the
pending bit also observe the published head; without it, weakly-
ordered architectures could let the consumer drain stale head and
delay the report. The consumer pairs this with an
smp_mb__after_atomic() between cpumask_clear_cpu() and reading
head, so a producer that publishes between the consumer's clear
and head-read is observed via the bit it re-sets rather than
silently stranded.
Consumer (kdamond_check_reported_accesses) drains the rings of CPUs
in damon_rings_pending, applying reports to targets.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
mm/damon/core.c | 143 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 101 insertions(+), 42 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index b605d36b29b1a..9ed789e932ebd 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -25,7 +25,26 @@
#define CREATE_TRACE_POINTS
#include <trace/events/damon.h>
-#define DAMON_ACCESS_REPORTS_CAP 1000
+/* Sized so the per-CPU ring set fits in L3 on typical multi-socket boxes. */
+#define DAMON_REPORT_RING_SIZE 256
+#define DAMON_REPORT_RING_MASK (DAMON_REPORT_RING_SIZE - 1)
+
+struct damon_report_ring {
+ unsigned int head; /* written by producer (NMI) */
+ unsigned int tail /* written by consumer (kdamond) */
+ ____cacheline_aligned_in_smp;
+ struct damon_access_report entries[DAMON_REPORT_RING_SIZE]
+ ____cacheline_aligned_in_smp;
+};
+
+static DEFINE_PER_CPU(struct damon_report_ring, damon_report_rings);
+static DEFINE_PER_CPU(int, damon_report_ring_busy);
+/*
+ * Per-CPU bitmap: producer (NMI) sets after publishing a report;
+ * consumer (kdamond) clears before draining the corresponding ring.
+ * Hot-write under sampling load - do NOT mark __read_mostly.
+ */
+static cpumask_t damon_rings_pending;
static DEFINE_MUTEX(damon_lock);
static int nr_running_ctxs;
@@ -36,10 +55,6 @@ static struct damon_operations damon_registered_ops[NR_DAMON_OPS];
static struct kmem_cache *damon_region_cache __ro_after_init;
-static DEFINE_MUTEX(damon_access_reports_lock);
-static struct damon_access_report damon_access_reports[
- DAMON_ACCESS_REPORTS_CAP];
-static int damon_access_reports_len;
/* Should be called under damon_ops_lock with id smaller than NR_DAMON_OPS */
static bool __damon_is_registered_ops(enum damon_ops_id id)
@@ -2127,33 +2142,56 @@ int damos_walk(struct damon_ctx *ctx, struct damos_walk_control *control)
}
/**
- * damon_report_access() - Report identified access events to DAMON.
- * @report: The reporting access information.
+ * damon_report_access() - Report a hardware-observed memory access.
+ * @report: pointer to a filled damon_access_report struct.
*
- * Report access events to DAMON.
- *
- * Context: May sleep.
- *
- * NOTE: we may be able to implement this as a lockless queue, and allow any
- * context. As the overhead is unknown, and region-based DAMON logics would
- * guarantee the reports would be not made that frequently, let's start with
- * this simple implementation.
+ * Context: NMI-safe. No sleeping, no allocation, no locks.
*/
void damon_report_access(struct damon_access_report *report)
{
- struct damon_access_report *dst;
+ struct damon_report_ring *ring;
+ unsigned int head, next;
- /* silently fail for races */
- if (!mutex_trylock(&damon_access_reports_lock))
- return;
- dst = &damon_access_reports[damon_access_reports_len++];
- /* just drop all existing reports in favor of simplicity. */
- if (damon_access_reports_len == DAMON_ACCESS_REPORTS_CAP)
- damon_access_reports_len = 0;
- *dst = *report;
- dst->report_jiffies = jiffies;
- mutex_unlock(&damon_access_reports_lock);
+ /* Pin to a CPU so the SPSC invariant holds for preemptible callers. */
+ preempt_disable();
+ /*
+ * NMI nesting on the same CPU as a process-context producer would
+ * stomp the same entries[head] slot. Detect and drop instead.
+ */
+ if (this_cpu_inc_return(damon_report_ring_busy) != 1) {
+ /* NMI nested on a process-context producer; drop. */
+ goto out;
+ }
+
+ ring = this_cpu_ptr(&damon_report_rings);
+ head = ring->head;
+ next = (head + 1) & DAMON_REPORT_RING_MASK;
+
+ if (next == READ_ONCE(ring->tail)) {
+ /* Ring full; consumer is behind, drop the report. */
+ goto out;
+ }
+
+ ring->entries[head] = *report;
+ ring->entries[head].report_jiffies = jiffies;
+ smp_wmb(); /* ensure entry visible before head advance */
+ WRITE_ONCE(ring->head, next);
+ /*
+ * Order the head advance before publishing the pending bit
+ * so that the consumer, on observing the bit, is also
+ * guaranteed to observe the new head. set_bit/cpumask_set_cpu
+ * are documented as unordered RMW (atomic_bitops.txt), hence
+ * the explicit barrier; without it, a weakly-ordered arch
+ * could let the consumer drain stale head, clear the bit, and
+ * delay the report until the next producer sets the bit again.
+ */
+ smp_mb__before_atomic();
+ cpumask_set_cpu(smp_processor_id(), &damon_rings_pending);
+out:
+ this_cpu_dec(damon_report_ring_busy);
+ preempt_enable();
}
+EXPORT_SYMBOL_GPL(damon_report_access);
#ifdef CONFIG_MMU
void damon_report_page_fault(struct vm_fault *vmf, bool huge_pmd)
@@ -3814,26 +3852,47 @@ static unsigned int kdamond_apply_zero_access_report(struct damon_ctx *ctx)
static unsigned int kdamond_check_reported_accesses(struct damon_ctx *ctx)
{
- int i;
- struct damon_access_report *report;
+ int cpu;
struct damon_target *t;
- /* currently damon_access_report supports only physical address */
- if (damon_target_has_pid(ctx))
- return 0;
+ for_each_cpu(cpu, &damon_rings_pending) {
+ struct damon_report_ring *ring =
+ per_cpu_ptr(&damon_report_rings, cpu);
+ unsigned int head, tail;
- mutex_lock(&damon_access_reports_lock);
- for (i = 0; i < damon_access_reports_len; i++) {
- report = &damon_access_reports[i];
- if (time_before(report->report_jiffies,
- jiffies -
- usecs_to_jiffies(
- ctx->attrs.sample_interval)))
- continue;
- damon_for_each_target(t, ctx)
- kdamond_apply_access_report(report, t, ctx);
+ cpumask_clear_cpu(cpu, &damon_rings_pending);
+ /*
+ * Pair with the producer's smp_mb__before_atomic() between
+ * the head publish and cpumask_set_cpu(): order the bit
+ * clear before the head read so that a producer publishing
+ * between our clear and our READ_ONCE(head) is observed via
+ * the bit it re-sets, not lost as a stale-head drain.
+ */
+ smp_mb__after_atomic();
+ head = READ_ONCE(ring->head);
+ /*
+ * Pair with smp_wmb in damon_report_access(): the entry
+ * data published before the producer advanced head must be
+ * visible to the entries[] reads inside the loop below.
+ */
+ smp_rmb();
+ tail = ring->tail;
+
+ while (tail != head) {
+ struct damon_access_report *report =
+ &ring->entries[tail];
+
+ if (!time_before(report->report_jiffies,
+ jiffies - usecs_to_jiffies(
+ ctx->attrs.sample_interval))) {
+ damon_for_each_target(t, ctx)
+ kdamond_apply_access_report(
+ report, t, ctx);
+ }
+ tail = (tail + 1) & DAMON_REPORT_RING_MASK;
+ }
+ WRITE_ONCE(ring->tail, tail);
}
- mutex_unlock(&damon_access_reports_lock);
/* For nr_accesses_bp, absence of access should also be reported. */
return kdamond_apply_zero_access_report(ctx);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 4/7] mm/damon/core: flat-array snapshot + bsearch in ring-drain loop
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
` (2 preceding siblings ...)
2026-05-16 22:34 ` [RFC PATCH 3/7] mm/damon/core: replace mutex-protected report buffer with per-CPU lockless ring Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 5/7] mm/damon: add sysfs binding and dispatch hookup for paddr_ibs operations Ravi Jonnalagadda
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
The drain loop is O(reports x regions) when matching each ring entry
back to a region. At sufficiently large CPU x region products the
linear scan exceeds the sample interval, producing unbounded backlog.
At drain start, snapshot each target's regions into a flat array
(struct damon_target_lookup), already sorted by ascending r->ar.start.
Replace the linear lookup with binary search over the snapshot,
reducing the drain to O(reports x log2(regions)).
Reject reports that straddle a region boundary
(addr + report->size > r->ar.end) so partial-region accesses are
not credited to the lower region.
If the snapshot allocation fails under memory pressure, log
ratelimited and fall through to zero-access reporting; the next
tick retries.
Hoist the per-report damon_sample_filter_out() check out of the
per-target loop so it runs once per ring entry rather than N times.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
include/linux/damon.h | 7 +++
mm/damon/core.c | 137 ++++++++++++++++++++++++++++++++++++------
2 files changed, 126 insertions(+), 18 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 8e6e1cd89e551..35cc3d42fcba8 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -1045,6 +1045,13 @@ struct damon_ctx {
/* Per-ctx PRNG state for damon_rand(); kdamond is the sole consumer. */
struct rnd_state rnd_state;
+ /* Reusable drain-loop snapshot buffer (avoids per-tick kmalloc) */
+ struct {
+ struct damon_target_lookup *lookups;
+ unsigned int nr_lookups;
+ struct damon_region **region_buf;
+ unsigned int region_buf_cap;
+ } drain_snapshot;
};
/* Get a random number in [@l, @r) using @ctx's lockless PRNG. */
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 9ed789e932ebd..03f9c671e8bc9 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -29,6 +29,13 @@
#define DAMON_REPORT_RING_SIZE 256
#define DAMON_REPORT_RING_MASK (DAMON_REPORT_RING_SIZE - 1)
+/* Per-target region lookup for drain loop */
+struct damon_target_lookup {
+ struct damon_region **regions;
+ unsigned int nr_regions;
+};
+
+
struct damon_report_ring {
unsigned int head; /* written by producer (NMI) */
unsigned int tail /* written by consumer (kdamond) */
@@ -855,6 +862,7 @@ struct damon_ctx *damon_new_ctx(void)
INIT_LIST_HEAD(&ctx->schemes);
prandom_seed_state(&ctx->rnd_state, get_random_u64());
+ /* drain_snapshot zero-initialized by kzalloc — no explicit init */
return ctx;
}
@@ -884,6 +892,8 @@ void damon_destroy_ctx(struct damon_ctx *ctx)
damon_for_each_sample_filter_safe(f, next_f, &ctx->sample_control)
damon_destroy_sample_filter(f, &ctx->sample_control);
+ kfree(ctx->drain_snapshot.lookups);
+ kfree(ctx->drain_snapshot.region_buf);
module_put(ctx->ops.owner);
kfree(ctx);
}
@@ -3806,27 +3816,44 @@ static bool damon_sample_filter_out(struct damon_access_report *report,
return !filter->allow;
}
+
static void kdamond_apply_access_report(struct damon_access_report *report,
- struct damon_target *t, struct damon_ctx *ctx)
+ struct damon_region **regions, unsigned int nr_regions,
+ struct damon_ctx *ctx)
{
struct damon_region *r;
unsigned long addr;
+ int left, right, mid;
- if (damon_sample_filter_out(report, &ctx->sample_control))
- return;
if (damon_target_has_pid(ctx))
addr = report->vaddr;
else
addr = report->paddr;
- /* todo: make search faster, e.g., binary search? */
- damon_for_each_region(r, t) {
- if (addr < r->ar.start)
- continue;
- if (r->ar.end < addr + report->size)
- continue;
- if (!r->access_reported)
- damon_update_region_access_rate(r, true, &ctx->attrs);
+ /* Binary search the snapshot for the region containing addr. */
+ left = 0;
+ right = nr_regions - 1;
+ r = NULL;
+ while (left <= right) {
+ /* Avoid (left + right) overflow at large nr_regions. */
+ mid = left + (right - left) / 2;
+ if (addr < regions[mid]->ar.start)
+ right = mid - 1;
+ else if (addr >= regions[mid]->ar.end)
+ left = mid + 1;
+ else {
+ r = regions[mid];
+ break;
+ }
+ }
+
+ if (!r)
+ return;
+ /* Reject reports straddling a region boundary. */
+ if (addr + report->size > r->ar.end)
+ return;
+ if (!r->access_reported) {
+ damon_update_region_access_rate(r, true, &ctx->attrs);
r->access_reported = true;
}
}
@@ -3850,10 +3877,79 @@ static unsigned int kdamond_apply_zero_access_report(struct damon_ctx *ctx)
return max_nr_accesses;
}
+/*
+ * Build a snapshot of the ctx's targets and their region arrays for
+ * use by the ring drain loop.
+ *
+ * The two-pass walk over adaptive_targets is safe even though
+ * krealloc_array() may sleep: target list mutation is funneled
+ * through damon_call onto the kdamond itself, so no other thread
+ * can mutate the list while kdamond is running this function.
+ */
+static struct damon_target_lookup *damon_build_target_lookup(
+ struct damon_ctx *ctx, unsigned int *nr_targets_out)
+{
+ struct damon_target *t;
+ struct damon_target_lookup *tbl;
+ unsigned int nr_targets = 0, total_regions = 0, ti = 0, ri = 0;
+
+ damon_for_each_target(t, ctx) {
+ nr_targets++;
+ total_regions += damon_nr_regions(t);
+ }
+
+ /* Realloc lookups array if needed */
+ if (nr_targets > ctx->drain_snapshot.nr_lookups) {
+ tbl = krealloc_array(ctx->drain_snapshot.lookups,
+ nr_targets, sizeof(*tbl), GFP_KERNEL);
+ if (!tbl)
+ return NULL;
+ ctx->drain_snapshot.lookups = tbl;
+ ctx->drain_snapshot.nr_lookups = nr_targets;
+ }
+ tbl = ctx->drain_snapshot.lookups;
+
+ /* Realloc contiguous region_buf if needed */
+ if (total_regions > ctx->drain_snapshot.region_buf_cap) {
+ struct damon_region **buf;
+
+ buf = krealloc_array(ctx->drain_snapshot.region_buf,
+ total_regions, sizeof(*buf), GFP_KERNEL);
+ if (!buf)
+ return NULL;
+ ctx->drain_snapshot.region_buf = buf;
+ ctx->drain_snapshot.region_buf_cap = total_regions;
+ }
+
+ /* Fill lookup table, slicing region_buf across targets */
+ ri = 0;
+ damon_for_each_target(t, ctx) {
+ struct damon_region *r;
+
+ tbl[ti].regions = &ctx->drain_snapshot.region_buf[ri];
+ tbl[ti].nr_regions = damon_nr_regions(t);
+ damon_for_each_region(r, t)
+ ctx->drain_snapshot.region_buf[ri++] = r;
+ ti++;
+ }
+
+ *nr_targets_out = nr_targets;
+ return tbl;
+}
+
static unsigned int kdamond_check_reported_accesses(struct damon_ctx *ctx)
{
int cpu;
- struct damon_target *t;
+ struct damon_target_lookup *tbl;
+ unsigned int nr_targets = 0;
+ unsigned int i;
+
+ tbl = damon_build_target_lookup(ctx, &nr_targets);
+ if (!tbl) {
+ pr_warn_ratelimited(
+ "damon: target-lookup alloc failed; ring drain skipped this tick\n");
+ return kdamond_apply_zero_access_report(ctx);
+ }
for_each_cpu(cpu, &damon_rings_pending) {
struct damon_report_ring *ring =
@@ -3881,14 +3977,19 @@ static unsigned int kdamond_check_reported_accesses(struct damon_ctx *ctx)
while (tail != head) {
struct damon_access_report *report =
&ring->entries[tail];
-
- if (!time_before(report->report_jiffies,
+ if (time_before(report->report_jiffies,
jiffies - usecs_to_jiffies(
- ctx->attrs.sample_interval))) {
- damon_for_each_target(t, ctx)
- kdamond_apply_access_report(
- report, t, ctx);
+ ctx->attrs.sample_interval)))
+ goto next;
+ if (damon_sample_filter_out(report,
+ &ctx->sample_control))
+ goto next;
+ for (i = 0; i < nr_targets; i++) {
+ kdamond_apply_access_report(report,
+ tbl[i].regions,
+ tbl[i].nr_regions, ctx);
}
+next:
tail = (tail + 1) & DAMON_REPORT_RING_MASK;
}
WRITE_ONCE(ring->tail, tail);
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 5/7] mm/damon: add sysfs binding and dispatch hookup for paddr_ibs operations
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
` (3 preceding siblings ...)
2026-05-16 22:34 ` [RFC PATCH 4/7] mm/damon/core: flat-array snapshot + bsearch in ring-drain loop Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 6/7] mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 7/7] mm/damon/damon_ibs: add AMD IBS-based access sampling backend Ravi Jonnalagadda
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
Extend damon_ops_id enum to include DAMON_OPS_PADDR_IBS and add the
corresponding 'paddr_ibs' name to the sysfs ops_names array so users
can select AMD IBS-based PA-mode monitoring via
/sys/kernel/mm/damon/admin/kdamonds/<N>/contexts/<N>/operations.
Route ops that report accesses through the hardware-sampling ring
(currently only DAMON_OPS_PADDR_IBS) through the existing
kdamond_check_reported_accesses() drain path used for page-fault
reports. A small helper damon_ops_is_hw_hotness() centralises the
classification so any future paddr-family backend that also reports
through the ring just adds a case here.
This routing is bound to ops.id rather than to a separate per-context
flag. A flag in damon_sample_control would have to be set by the ops
.init callback after damon_select_ops() and would then need to be
preserved by damon_commit_sample_control() across sysfs commits;
deriving from ops.id avoids both pitfalls.
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
include/linux/damon.h | 2 ++
mm/damon/core.c | 13 ++++++++++++-
mm/damon/sysfs.c | 12 +++++++++---
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 35cc3d42fcba8..16da528845d03 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -669,12 +669,14 @@ struct damos {
* @DAMON_OPS_FVADDR: Monitoring operations for only fixed ranges of virtual
* address spaces
* @DAMON_OPS_PADDR: Monitoring operations for the physical address space
+ * @DAMON_OPS_PADDR_IBS: AMD IBS-based PA-mode monitoring
* @NR_DAMON_OPS: Number of monitoring operations implementations
*/
enum damon_ops_id {
DAMON_OPS_VADDR,
DAMON_OPS_FVADDR,
DAMON_OPS_PADDR,
+ DAMON_OPS_PADDR_IBS,
NR_DAMON_OPS,
};
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 03f9c671e8bc9..2aa031cbc70b7 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -73,6 +73,16 @@ static bool __damon_is_registered_ops(enum damon_ops_id id)
return true;
}
+/*
+ * Returns true if the given ops id reports access samples through the
+ * hardware-sampling ring-buffer drain path (rather than its own
+ * .check_accesses callback).
+ */
+static bool damon_ops_is_hw_hotness(enum damon_ops_id id)
+{
+ return 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.
@@ -4048,7 +4058,8 @@ static int kdamond_fn(void *data)
ctx->passed_sample_intervals++;
/* todo: make these non-exclusive */
- if (ctx->sample_control.primitives_enabled.page_fault)
+ if (ctx->sample_control.primitives_enabled.page_fault ||
+ damon_ops_is_hw_hotness(ctx->ops.id))
max_nr_accesses = kdamond_check_reported_accesses(ctx);
else if (ctx->ops.check_accesses)
max_nr_accesses = ctx->ops.check_accesses(ctx);
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index fc7256e522a69..261ccf0c61846 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1388,6 +1388,10 @@ static const struct damon_sysfs_ops_name damon_sysfs_ops_names[] = {
.ops_id = DAMON_OPS_PADDR,
.name = "paddr",
},
+ {
+ .ops_id = DAMON_OPS_PADDR_IBS,
+ .name = "paddr_ibs",
+ },
};
struct damon_sysfs_context {
@@ -2023,7 +2027,8 @@ static int damon_sysfs_add_targets(struct damon_ctx *ctx,
int i, err;
/* Multiple physical address space monitoring targets makes no sense */
- if (ctx->ops.id == DAMON_OPS_PADDR && sysfs_targets->nr > 1)
+ if ((ctx->ops.id == DAMON_OPS_PADDR ||
+ ctx->ops.id == DAMON_OPS_PADDR_IBS) && sysfs_targets->nr > 1)
return -EINVAL;
for (i = 0; i < sysfs_targets->nr; i++) {
@@ -2072,8 +2077,9 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
if (err)
return err;
ctx->addr_unit = sys_ctx->addr_unit;
- /* addr_unit is respected by only DAMON_OPS_PADDR */
- if (sys_ctx->ops_id == DAMON_OPS_PADDR)
+ /* addr_unit is respected by only paddr-family ops */
+ if (sys_ctx->ops_id == DAMON_OPS_PADDR ||
+ sys_ctx->ops_id == DAMON_OPS_PADDR_IBS)
ctx->min_region_sz = max(
DAMON_MIN_REGION_SZ / sys_ctx->addr_unit, 1);
ctx->pause = sys_ctx->pause;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 6/7] mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
` (4 preceding siblings ...)
2026-05-16 22:34 ` [RFC PATCH 5/7] mm/damon: add sysfs binding and dispatch hookup for paddr_ibs operations Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 7/7] mm/damon/damon_ibs: add AMD IBS-based access sampling backend Ravi Jonnalagadda
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 7/7] mm/damon/damon_ibs: add AMD IBS-based access sampling backend
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
` (5 preceding siblings ...)
2026-05-16 22:34 ` [RFC PATCH 6/7] mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check Ravi Jonnalagadda
@ 2026-05-16 22:34 ` Ravi Jonnalagadda
6 siblings, 0 replies; 8+ messages in thread
From: Ravi Jonnalagadda @ 2026-05-16 22:34 UTC (permalink / raw)
To: sj, damon, linux-mm, linux-kernel, linux-doc
Cc: akpm, corbet, bijan311, ajayjoshi, honggyu.kim, yunjeong.mun,
ravis.opensrc, bharata
Add paddr_ibs operations using AMD IBS Op sampling via
perf_event_create_kernel_counter(). IBS delivers physical-address-
keyed access reports to DAMON's shared-layer ring buffer
(damon_report_access()), without dependency on PTE Accessed-bit
scanning or page faults.
Per-CPU IBS events are created and torn down via cpuhp notifiers
(CPUHP_AP_ONLINE_DYN). Routing of access reports through the ring-
drain path is bound to ops.id == DAMON_OPS_PADDR_IBS at the dispatch
site (see "mm/damon: add sysfs binding and dispatch hookup for
paddr_ibs operations"), so .init does not need to flip a per-context
flag.
Sample-time discipline:
- PERF_SAMPLE_PHYS_ADDR is requested in attr.sample_type, but the
IBS perf driver only fills data->phys_addr when
IBS_OP_DATA3.dc_phy_addr_valid is set. Skip stale-PA samples by
inspecting data->sample_flags rather than testing phys_addr for
zero (which would also drop legitimate page 0).
- PERF_SAMPLE_DATA_SRC is requested so the perf driver decodes
IBS_OP_DATA3.{ld_op,st_op} into data->data_src.mem_op; the
backend reports load vs store accordingly via
damon_access_report.is_write.
Module parameters:
- max_cnt: IBS Op MaxCnt (writable; writes call
damon_ibs_set_sample_rate() to restart sampling at the new rate)
- samples_total / samples_filtered: per-CPU-aggregated counters
(read-only)
Source file is mm/damon/damon_ibs.c (renamed from mm/damon/ibs.c) so
the resulting module is loaded as damon_ibs.ko, avoiding the generic
"ibs" namespace.
The IBS sampling approach is derived from Bharata B Rao's pghot RFC v5
series; the attribution header is in damon_ibs.c.
Suggested-by: Bharata B Rao <bharata@amd.com>
Link: https://lore.kernel.org/linux-mm/20260129144043.231636-1-bharata@amd.com/
Signed-off-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
---
mm/damon/Kconfig | 10 ++
mm/damon/Makefile | 1 +
mm/damon/damon_ibs.c | 369 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 380 insertions(+)
create mode 100644 mm/damon/damon_ibs.c
diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig
index ad629f0f31d8d..bb698d2717f34 100644
--- a/mm/damon/Kconfig
+++ b/mm/damon/Kconfig
@@ -131,4 +131,14 @@ config DAMON_ACMA
min/max memory for the system and maximum memory pressure stall time
ratio.
+config DAMON_IBS
+ tristate "AMD IBS-based access sampling for DAMON"
+ depends on DAMON_PADDR && CPU_SUP_AMD && X86_64 && PERF_EVENTS
+ help
+ Uses AMD IBS (Instruction-Based Sampling) hardware to deliver
+ physical-address-keyed access reports to DAMON's shared-layer
+ ring buffer, without relying on PTE Accessed-bit scanning or
+ page faults. Registers as the "paddr_ibs" operations set.
+ Requires AMD processors with IBS Op support.
+
endmenu
diff --git a/mm/damon/Makefile b/mm/damon/Makefile
index 22494754f41e8..109d0fb1db97d 100644
--- a/mm/damon/Makefile
+++ b/mm/damon/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_DAMON_RECLAIM) += modules-common.o reclaim.o
obj-$(CONFIG_DAMON_LRU_SORT) += modules-common.o lru_sort.o
obj-$(CONFIG_DAMON_STAT) += modules-common.o stat.o
obj-$(CONFIG_DAMON_ACMA) += modules-common.o acma.o
+obj-$(CONFIG_DAMON_IBS) += damon_ibs.o
diff --git a/mm/damon/damon_ibs.c b/mm/damon/damon_ibs.c
new file mode 100644
index 0000000000000..1dd99e91c3928
--- /dev/null
+++ b/mm/damon/damon_ibs.c
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DAMON IBS (Instruction-Based Sampling) backend for AMD processors.
+ *
+ * Uses AMD IBS Op sampling via the perf kernel counter infrastructure to
+ * deliver PA-keyed access reports to DAMON's shared-layer ring buffer
+ * (see damon_report_access()). This enables physical-address hot-page
+ * detection without relying on page-table Accessed bits or page faults.
+ *
+ * The IBS sampling approach in this file derives from concepts in
+ * Bharata B Rao's pghot RFC v5 series for hot page tracking.
+ * See: https://lore.kernel.org/linux-mm/20260129144043.231636-1-bharata@amd.com/
+ *
+ * Author: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
+ */
+
+#include <linux/cpu.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/percpu.h>
+#include <linux/perf_event.h>
+#include <linux/slab.h>
+#include <linux/smp.h>
+
+#include <linux/damon.h>
+#include "ops-common.h"
+
+#define DAMON_IBS_DEFAULT_MAX_CNT 262144 /* ~4K samples/sec/core */
+#define IBS_OP_PMU_TYPE_PATH "/sys/bus/event_source/devices/ibs_op/type"
+
+static unsigned int damon_ibs_max_cnt = DAMON_IBS_DEFAULT_MAX_CNT;
+
+static int damon_ibs_set_sample_rate(unsigned int max_cnt);
+
+static int max_cnt_set(const char *val, const struct kernel_param *kp)
+{
+ unsigned int new_cnt;
+ int ret;
+
+ ret = kstrtouint(val, 0, &new_cnt);
+ if (ret)
+ return ret;
+ if (!new_cnt)
+ return -EINVAL;
+ return damon_ibs_set_sample_rate(new_cnt);
+}
+static const struct kernel_param_ops max_cnt_ops = {
+ .set = max_cnt_set,
+ .get = param_get_uint,
+};
+module_param_cb(max_cnt, &max_cnt_ops, &damon_ibs_max_cnt, 0644);
+MODULE_PARM_DESC(max_cnt,
+ "IBS MaxCnt (ops between samples). Writes restart sampling.");
+
+static DEFINE_MUTEX(damon_ibs_lock);
+static bool damon_ibs_enabled;
+static enum cpuhp_state damon_ibs_cpuhp_state;
+static unsigned int ibs_pmu_type; /* discovered at init */
+
+static DEFINE_PER_CPU(struct perf_event *, damon_ibs_event);
+
+/*
+ * Diagnostic counters. Incremented from NMI context, so use per-CPU
+ * counters and sum them on read.
+ */
+static DEFINE_PER_CPU(unsigned long, ibs_samples_total_pcpu);
+static DEFINE_PER_CPU(unsigned long, ibs_samples_filtered_pcpu);
+
+static unsigned long damon_ibs_sum_pcpu(unsigned long __percpu *var)
+{
+ unsigned long sum = 0;
+ int cpu;
+
+ for_each_possible_cpu(cpu)
+ sum += per_cpu(*var, cpu);
+ return sum;
+}
+
+static int samples_total_get(char *buffer, const struct kernel_param *kp)
+{
+ return sysfs_emit(buffer, "%lu\n",
+ damon_ibs_sum_pcpu(&ibs_samples_total_pcpu));
+}
+
+static int samples_filtered_get(char *buffer, const struct kernel_param *kp)
+{
+ return sysfs_emit(buffer, "%lu\n",
+ damon_ibs_sum_pcpu(&ibs_samples_filtered_pcpu));
+}
+
+static const struct kernel_param_ops samples_total_ops = {
+ .get = samples_total_get,
+};
+static const struct kernel_param_ops samples_filtered_ops = {
+ .get = samples_filtered_get,
+};
+
+module_param_cb(samples_total, &samples_total_ops, NULL, 0444);
+MODULE_PARM_DESC(samples_total, "Total IBS samples delivered (read-only)");
+module_param_cb(samples_filtered, &samples_filtered_ops, NULL, 0444);
+MODULE_PARM_DESC(samples_filtered, "IBS samples filtered out (read-only)");
+
+/**
+ * damon_ibs_overflow_handler() - IBS overflow callback.
+ *
+ * Called when an IBS Op counter overflows. The IBS perf driver fills
+ * data->phys_addr from IBSDCPHYSAD when dc_phy_addr_valid is set.
+ *
+ * Context: NMI — no sleeping, no mutex, no kmalloc.
+ */
+static void damon_ibs_overflow_handler(struct perf_event *event,
+ struct perf_sample_data *data,
+ struct pt_regs *regs)
+{
+ struct damon_access_report report;
+ unsigned long phys_addr;
+
+ if (!data)
+ return;
+
+ /*
+ * PERF_SAMPLE_PHYS_ADDR was requested in attr.sample_type, but
+ * the IBS perf driver only populates data->phys_addr when
+ * IBS_OP_DATA3.dc_phy_addr_valid is set. Skip stale-PA samples
+ * by checking the sample_flags rather than testing phys_addr
+ * for zero (which would also drop legitimate page 0).
+ */
+ if (!(data->sample_flags & PERF_SAMPLE_PHYS_ADDR)) {
+ this_cpu_inc(ibs_samples_filtered_pcpu);
+ return;
+ }
+ phys_addr = data->phys_addr;
+
+ report = (struct damon_access_report){
+ .paddr = phys_addr & PAGE_MASK,
+ .size = PAGE_SIZE,
+ .cpu = smp_processor_id(),
+ .is_write = !!(data->data_src.mem_op & PERF_MEM_OP_STORE),
+ };
+ damon_report_access(&report);
+ this_cpu_inc(ibs_samples_total_pcpu);
+}
+
+static int damon_ibs_create_event(int cpu)
+{
+ struct perf_event_attr attr = {
+ .type = ibs_pmu_type,
+ .size = sizeof(attr),
+ /* config=0: IBS perf driver uses sample_period as MaxCnt. */
+ .config = 0,
+ .sample_period = damon_ibs_max_cnt,
+ .sample_type = PERF_SAMPLE_PHYS_ADDR | PERF_SAMPLE_DATA_SRC,
+ .pinned = 1,
+ };
+ struct perf_event *event;
+
+ event = perf_event_create_kernel_counter(&attr, cpu, NULL,
+ damon_ibs_overflow_handler,
+ NULL);
+ if (IS_ERR(event))
+ return PTR_ERR(event);
+
+ /*
+ * perf_event_create_kernel_counter() returns the event already
+ * enabled; no perf_event_enable() needed here.
+ */
+ per_cpu(damon_ibs_event, cpu) = event;
+ return 0;
+}
+
+static void damon_ibs_destroy_event(int cpu)
+{
+ struct perf_event *event = per_cpu(damon_ibs_event, cpu);
+
+ if (!event)
+ return;
+
+ perf_event_disable(event);
+ perf_event_release_kernel(event);
+ per_cpu(damon_ibs_event, cpu) = NULL;
+}
+
+static int damon_ibs_cpu_online(unsigned int cpu)
+{
+ int ret = damon_ibs_create_event(cpu);
+
+ if (ret)
+ pr_warn_ratelimited(
+ "damon-ibs: failed to create perf_event on cpu %u (err %d); "
+ "this cpu will not contribute samples\n", cpu, ret);
+ return 0; /* never block CPU online */
+}
+
+static int damon_ibs_cpu_offline(unsigned int cpu)
+{
+ damon_ibs_destroy_event(cpu);
+ return 0;
+}
+
+/* Caller must hold damon_ibs_lock. */
+static int __damon_ibs_start(void)
+{
+ int ret;
+
+ if (damon_ibs_enabled)
+ return -EBUSY;
+
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "damon/ibs:online",
+ damon_ibs_cpu_online, damon_ibs_cpu_offline);
+ if (ret < 0)
+ return ret;
+ damon_ibs_cpuhp_state = ret;
+
+ damon_ibs_enabled = true;
+ pr_info_once("damon-ibs: first start (max_cnt=%u, pmu_type=%u)\n",
+ damon_ibs_max_cnt, ibs_pmu_type);
+ return 0;
+}
+
+/* Caller must hold damon_ibs_lock. */
+static void __damon_ibs_stop(void)
+{
+ if (!damon_ibs_enabled)
+ return;
+
+ cpuhp_remove_state(damon_ibs_cpuhp_state);
+ damon_ibs_enabled = false;
+}
+
+static int damon_ibs_start(void)
+{
+ int ret;
+
+ mutex_lock(&damon_ibs_lock);
+ ret = __damon_ibs_start();
+ mutex_unlock(&damon_ibs_lock);
+ return ret;
+}
+
+static void damon_ibs_stop(void)
+{
+ mutex_lock(&damon_ibs_lock);
+ __damon_ibs_stop();
+ mutex_unlock(&damon_ibs_lock);
+}
+
+/**
+ * damon_ibs_set_sample_rate() - Set IBS sampling interval.
+ * @max_cnt: IBS Op MaxCnt value (ops between samples).
+ * Higher = fewer samples/sec.
+ *
+ * If IBS is already running, restart it with the new rate.
+ *
+ * Return: 0 on success; if a restart was required and failed,
+ * propagate the error so callers (e.g. the max_cnt module-param
+ * .set callback) surface it to userspace instead of silently
+ * leaving sampling stopped.
+ */
+static int damon_ibs_set_sample_rate(unsigned int max_cnt)
+{
+ int ret = 0;
+
+ mutex_lock(&damon_ibs_lock);
+ damon_ibs_max_cnt = max_cnt ? max_cnt : DAMON_IBS_DEFAULT_MAX_CNT;
+
+ if (damon_ibs_enabled) {
+ __damon_ibs_stop();
+ ret = __damon_ibs_start();
+ if (ret)
+ pr_warn("damon-ibs: restart failed: %d\n", ret);
+ }
+ mutex_unlock(&damon_ibs_lock);
+ return ret;
+}
+
+
+static void damon_ibs_init_ctx(struct damon_ctx *ctx)
+{
+ int ret;
+
+ /* IBS is the access-detection source for this ctx. */
+ ctx->sample_control.primitives_enabled.page_table = false;
+
+ ret = damon_ibs_start();
+ if (ret && ret != -EBUSY)
+ pr_warn("damon-ibs: failed to start IBS sampling: %d\n", ret);
+}
+
+/**
+ * damon_ibs_discover_pmu_type() - Discover IBS Op PMU type from sysfs.
+ *
+ * Reads /sys/bus/event_source/devices/ibs_op/type to get the PMU type
+ * identifier needed for perf_event_attr.type.
+ *
+ * TODO: replace sysfs-read with a PMU lookup API when one becomes
+ * available.
+ *
+ * Return: 0 on success, negative error code otherwise.
+ */
+static int damon_ibs_discover_pmu_type(void)
+{
+ struct file *f;
+ char buf[16];
+ loff_t pos = 0;
+ ssize_t len;
+ int ret;
+
+ f = filp_open(IBS_OP_PMU_TYPE_PATH, O_RDONLY, 0);
+ if (IS_ERR(f))
+ return PTR_ERR(f);
+
+ len = kernel_read(f, buf, sizeof(buf) - 1, &pos);
+ filp_close(f, NULL);
+ if (len <= 0)
+ return -EIO;
+
+ buf[len] = '\0';
+ ret = kstrtouint(strim(buf), 10, &ibs_pmu_type);
+ if (ret)
+ return ret;
+
+ pr_info("damon-ibs: discovered ibs_op PMU type=%u\n", ibs_pmu_type);
+ return 0;
+}
+
+static int __init damon_ibs_init(void)
+{
+ struct damon_operations ops = {
+ .id = DAMON_OPS_PADDR_IBS,
+ .owner = THIS_MODULE,
+ .init = damon_ibs_init_ctx,
+ .prepare_access_checks = damon_pa_prepare_access_checks,
+ .check_accesses = damon_pa_check_accesses,
+ .apply_probes = damon_pa_apply_probes,
+ .apply_scheme = damon_pa_apply_scheme,
+ .get_scheme_score = damon_pa_scheme_score,
+ };
+ int err;
+
+ if (!boot_cpu_has(X86_FEATURE_IBS))
+ return -ENODEV;
+
+ err = damon_ibs_discover_pmu_type();
+ if (err) {
+ pr_err("damon-ibs: failed to discover IBS PMU type: %d\n", err);
+ return err;
+ }
+
+ err = damon_register_ops(&ops);
+ if (err)
+ return err;
+
+ pr_info("damon-ibs: AMD IBS backend registered (max_cnt=%u, pmu_type=%u)\n",
+ damon_ibs_max_cnt, ibs_pmu_type);
+ return 0;
+}
+
+static void __exit damon_ibs_exit(void)
+{
+ damon_ibs_stop();
+ damon_unregister_ops(DAMON_OPS_PADDR_IBS);
+}
+
+module_init(damon_ibs_init);
+module_exit(damon_ibs_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Ravi Jonnalagadda <ravis.opensrc@gmail.com>");
+MODULE_DESCRIPTION("AMD IBS-based access sampling backend for DAMON");
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-16 22:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-16 22:34 [RFC PATCH 0/7] mm/damon: hardware-sampled access reports + AMD IBS Op example Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 1/7] mm/damon/core: refcount ops owner module to prevent rmmod UAF Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 2/7] mm/damon/paddr: export damon_pa_* ops for IBS module Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 3/7] mm/damon/core: replace mutex-protected report buffer with per-CPU lockless ring Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 4/7] mm/damon/core: flat-array snapshot + bsearch in ring-drain loop Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 5/7] mm/damon: add sysfs binding and dispatch hookup for paddr_ibs operations Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 6/7] mm/damon/core: accept paddr_ibs in node_eligible_mem_bp ops check Ravi Jonnalagadda
2026-05-16 22:34 ` [RFC PATCH 7/7] mm/damon/damon_ibs: add AMD IBS-based access sampling backend Ravi Jonnalagadda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.