[RFC PATCH 23/27] mm/damon/sysfs: implement submit command for report producer
From: SJ Park
Date: Sun Nov 15 2026 - 15:30:29 EST
Let users manually submit a report of a data attribute for a given
address range of memory. Let producer_state receive "submit" input for
that. For the input, generate the report based on user inputs that are
written to the appropriate sysfs files and submit to DAMON using the
core API, damon_submit_report().
Signed-off-by: SJ Park <sj@xxxxxxxxxx>
---
mm/damon/sysfs.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 5f9bb1955dfd5..0049aac6ab974 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -3107,13 +3107,26 @@ static ssize_t producer_state_store(struct kobject *kobj,
{
struct damon_sysfs_producer *producer = container_of(kobj,
struct damon_sysfs_producer, kobj);
+ struct damon_report report;
+ int err;
- if (sysfs_streq(buf, "on"))
+ if (sysfs_streq(buf, "on")) {
producer->enabled = true;
- else if (sysfs_streq(buf, "off"))
+ } else if (sysfs_streq(buf, "off")) {
producer->enabled = false;
- else
+ } else if (sysfs_streq(buf, "submit")) {
+ if (!producer->enabled)
+ return -EINVAL;
+ if (producer->report_type != DAMON_REPORT_TYPE_USER_REPORT)
+ return -EINVAL;
+ report.type = DAMON_REPORT_TYPE_USER_REPORT;
+ report.addr_range = producer->addr_range;
+ err = damon_submit_report(&report);
+ if (err)
+ return err;
+ } else {
return -EINVAL;
+ }
return count;
}
--
2.47.3