summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-01-06 20:33:57 +0100
committerAndrew Morton <akpm@linux-foundation.org>2025-01-26 05:22:28 +0100
commitcfc33a7d2daca4455ef3ebae63a2e89bd9bb0ebe (patch)
treef091c654a38507251b73e153a267d1b0e32d1eea /mm
parentDocs/ABI/damon: document per-scheme filter-passed bytes stat file (diff)
downloadlinux-cfc33a7d2daca4455ef3ebae63a2e89bd9bb0ebe.tar.xz
linux-cfc33a7d2daca4455ef3ebae63a2e89bd9bb0ebe.zip
mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn()
Total size of memory that passed DAMON operations set layer-handled DAMOS filters per scheme is provided to DAMON core API and ABI (sysfs interface) users. Having it per-region in non-accumulated way can provide it in finer granularity. Provide it to damos_walk() core API users, by passing the data to damos_walk_control->walk_fn(). Link: https://lkml.kernel.org/r/20250106193401.109161-13-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/damon/core.c7
-rw-r--r--mm/damon/sysfs.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index c4ce72a86d81..52e50f183ffe 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1445,7 +1445,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t,
* installed by damos_walk() and not yet uninstalled, invoke it.
*/
static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
- struct damon_region *r, struct damos *s)
+ struct damon_region *r, struct damos *s,
+ unsigned long sz_filter_passed)
{
struct damos_walk_control *control;
@@ -1454,7 +1455,7 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
mutex_unlock(&ctx->walk_control_lock);
if (!control)
return;
- control->walk_fn(control->data, ctx, t, r, s);
+ control->walk_fn(control->data, ctx, t, r, s, sz_filter_passed);
}
/*
@@ -1574,7 +1575,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
sz_applied = c->ops.apply_scheme(c, t, r, s,
&sz_ops_filter_passed);
}
- damos_walk_call_walk(c, t, r, s);
+ damos_walk_call_walk(c, t, r, s, sz_ops_filter_passed);
ktime_get_coarse_ts64(&end);
quota->total_charged_ns += timespec64_to_ns(&end) -
timespec64_to_ns(&begin);
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index cf8fb5a963d6..224873ca8aa6 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1454,7 +1454,7 @@ struct damon_sysfs_schemes_walk_data {
/* populate the region directory */
static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
- struct damos *s)
+ struct damos *s, unsigned long sz_filter_passed)
{
struct damon_sysfs_schemes_walk_data *walk_data = data;
struct damon_sysfs_kdamond *sysfs_kdamond = walk_data->sysfs_kdamond;