Skip to content

Commit 99ce7c9

Browse files
sjp38akpm00
authored andcommitted
mm/damon: remove damon_callback->before_damos_apply
The hook was introduced to let DAMON kernel API users access DAMOS schemes-eligible regions in a safe way. Now it is no more used by anyone, and the functionality is provided in a better way by damos_walk(). Remove it. Link: https://lkml.kernel.org/r/20250306175908.66300-13-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent cedee98 commit 99ce7c9

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

include/linux/damon.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,6 @@ struct damon_operations {
605605
*
606606
* @after_wmarks_check: Called after each schemes' watermarks check.
607607
* @after_aggregation: Called after each aggregation.
608-
* @before_damos_apply: Called before applying DAMOS action.
609608
* @before_terminate: Called before terminating the monitoring.
610609
*
611610
* The monitoring thread (&damon_ctx.kdamond) calls @before_terminate just
@@ -626,10 +625,6 @@ struct damon_operations {
626625
struct damon_callback {
627626
int (*after_wmarks_check)(struct damon_ctx *context);
628627
int (*after_aggregation)(struct damon_ctx *context);
629-
int (*before_damos_apply)(struct damon_ctx *context,
630-
struct damon_target *target,
631-
struct damon_region *region,
632-
struct damos *scheme);
633628
void (*before_terminate)(struct damon_ctx *context);
634629
};
635630

mm/damon/core.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,6 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
17311731
struct timespec64 begin, end;
17321732
unsigned long sz_applied = 0;
17331733
unsigned long sz_ops_filter_passed = 0;
1734-
int err = 0;
17351734
/*
17361735
* We plan to support multiple context per kdamond, as DAMON sysfs
17371736
* implies with 'nr_contexts' file. Nevertheless, only single context
@@ -1771,14 +1770,10 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
17711770
if (damos_filter_out(c, t, r, s))
17721771
return;
17731772
ktime_get_coarse_ts64(&begin);
1774-
if (c->callback.before_damos_apply)
1775-
err = c->callback.before_damos_apply(c, t, r, s);
1776-
if (!err) {
1777-
trace_damos_before_apply(cidx, sidx, tidx, r,
1778-
damon_nr_regions(t), do_trace);
1779-
sz_applied = c->ops.apply_scheme(c, t, r, s,
1780-
&sz_ops_filter_passed);
1781-
}
1773+
trace_damos_before_apply(cidx, sidx, tidx, r,
1774+
damon_nr_regions(t), do_trace);
1775+
sz_applied = c->ops.apply_scheme(c, t, r, s,
1776+
&sz_ops_filter_passed);
17821777
damos_walk_call_walk(c, t, r, s, sz_ops_filter_passed);
17831778
ktime_get_coarse_ts64(&end);
17841779
quota->total_charged_ns += timespec64_to_ns(&end) -

0 commit comments

Comments
 (0)