* Re: [PATCH v1] mm/damon: remove unused code
2026-02-12 15:41 ` SeongJae Park
@ 2026-02-12 16:51 ` SeongJae Park
2026-02-13 9:22 ` Gutierrez Asier
1 sibling, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2026-02-12 16:51 UTC (permalink / raw)
To: SeongJae Park
Cc: gutierrez.asier, artem.kuzin, stepanov.anatoly, wangkefeng.wang,
yanquanmin1, zuoze1, damon, akpm, linux-mm, linux-kernel
On Thu, 12 Feb 2026 07:41:56 -0800 SeongJae Park <sj@kernel.org> wrote:
> On Thu, 12 Feb 2026 09:43:26 +0000 <gutierrez.asier@huawei-partners.com> wrote:
>
> > From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> >
> > damon_target is not used by get_scheme_score operations, nor with
> > virtual neither with physical addresses.
>
> Good finding, thank you for this patch, Asier!
>
> The subject seems bit ambiguous, though. What about "remove unused target
> param of get_scheme_score()" ?
>
> >
> > Signed-off-by: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>
> Other than the subject,
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
>
> Also, DAMON patches are recommended to use mm-new as thier baseline [1] unless
> there are other reasons to not to do so. But I found 'git am' of this patch on
> the mm-new fails. It works on the master of mm.git, which is a commit of
> Linus' tree, though. So, maybe this patch is not using mm-new as the baseline?
> Please consider using mm-new as the baseline next time, or specify why you use
> choose different tree as the baseline.
>
> Assuming you are ok to the subject change (let me know if you are not), I'm
> attaching a new version of this patch that has changed the subject with my
> suggestion, and manually resolved the conflicts on mm-new, for Andrew's
> convenience. I also applied that to my tree (damon/next), and I will repost it
> if Andrew miss this (as we are in the middle of merge window, maintainers could
> miss many things).
>
> [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
>
>
> Thanks,
> SJ
>
> [...]
> ======= >8 =======
> From e09d66bb116604c9dc5b22540641e991d977ea6b Mon Sep 17 00:00:00 2001
> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> Date: Thu, 12 Feb 2026 09:43:26 +0000
> Subject: [PATCH] mm/damon/: remove unused target param of get_scheme_score()
>
> damon_target is not used by get_scheme_score operations, nor with
> virtual neither with physical addresses.
>
> Signed-off-by: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>
> Link: https://patch.msgid.link/20260212094326.906497-1-gutierrez.asier@huawei-partners.com
Oops, I attached an old version of the modified patch that not adjusted this
tags area. Andrew, if you pick this up, could you please add below together:
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> include/linux/damon.h | 3 +--
> mm/damon/core.c | 10 +++++-----
> mm/damon/paddr.c | 3 +--
> mm/damon/vaddr.c | 3 +--
> 4 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index a4fea23da8576..9a88cf8d152d8 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -647,8 +647,7 @@ struct damon_operations {
> void (*prepare_access_checks)(struct damon_ctx *context);
> unsigned int (*check_accesses)(struct damon_ctx *context);
> int (*get_scheme_score)(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme);
> + struct damon_region *r, struct damos *scheme);
> unsigned long (*apply_scheme)(struct damon_ctx *context,
> struct damon_target *t, struct damon_region *r,
> struct damos *scheme, unsigned long *sz_filter_passed);
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 5e2724a4f285e..925908415a041 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1679,15 +1679,15 @@ static bool __damos_valid_target(struct damon_region *r, struct damos *s)
> r->age <= s->pattern.max_age_region;
> }
>
> -static bool damos_valid_target(struct damon_ctx *c, struct damon_target *t,
> - struct damon_region *r, struct damos *s)
> +static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r,
> + struct damos *s)
> {
> bool ret = __damos_valid_target(r, s);
>
> if (!ret || !s->quota.esz || !c->ops.get_scheme_score)
> return ret;
>
> - return c->ops.get_scheme_score(c, t, r, s) >= s->quota.min_score;
> + return c->ops.get_scheme_score(c, r, s) >= s->quota.min_score;
> }
>
> /*
> @@ -2011,7 +2011,7 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
> s->max_nr_snapshots <= s->stat.nr_snapshots)
> continue;
>
> - if (damos_valid_target(c, t, r, s))
> + if (damos_valid_target(c, r, s))
> damos_apply_scheme(c, t, r, s);
>
> if (damon_is_last_region(r, t))
> @@ -2309,7 +2309,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> damon_for_each_region(r, t) {
> if (!__damos_valid_target(r, s))
> continue;
> - score = c->ops.get_scheme_score(c, t, r, s);
> + score = c->ops.get_scheme_score(c, r, s);
> c->regions_score_histogram[score] +=
> damon_sz_region(r);
> if (score > max_score)
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 9bfe488268407..5cdcc5037cbc1 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -343,8 +343,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
> }
>
> static int damon_pa_scheme_score(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme)
> + struct damon_region *r, struct damos *scheme)
> {
> switch (scheme->action) {
> case DAMOS_PAGEOUT:
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 83ab3d8c37920..4e3430d4191d1 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -986,8 +986,7 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx,
> }
>
> static int damon_va_scheme_score(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme)
> + struct damon_region *r, struct damos *scheme)
> {
>
> switch (scheme->action) {
> --
> 2.47.3
Sent using hkml (https://github.com/sjp38/hackermail)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v1] mm/damon: remove unused code
2026-02-12 15:41 ` SeongJae Park
2026-02-12 16:51 ` SeongJae Park
@ 2026-02-13 9:22 ` Gutierrez Asier
1 sibling, 0 replies; 4+ messages in thread
From: Gutierrez Asier @ 2026-02-13 9:22 UTC (permalink / raw)
To: SeongJae Park
Cc: artem.kuzin, stepanov.anatoly, wangkefeng.wang, yanquanmin1,
zuoze1, damon, akpm, linux-mm, linux-kernel
Hi,
On 2/12/2026 6:41 PM, SeongJae Park wrote:
> On Thu, 12 Feb 2026 09:43:26 +0000 <gutierrez.asier@huawei-partners.com> wrote:
>
>> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>>
>> damon_target is not used by get_scheme_score operations, nor with
>> virtual neither with physical addresses.
>
> Good finding, thank you for this patch, Asier!
>
> The subject seems bit ambiguous, though. What about "remove unused target
> param of get_scheme_score()" ?
>
>>
>> Signed-off-by: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>
> Other than the subject,
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
>
> Also, DAMON patches are recommended to use mm-new as thier baseline [1] unless
> there are other reasons to not to do so. But I found 'git am' of this patch on
> the mm-new fails. It works on the master of mm.git, which is a commit of
> Linus' tree, though. So, maybe this patch is not using mm-new as the baseline?
> Please consider using mm-new as the baseline next time, or specify why you use
> choose different tree as the baseline.
>
> Assuming you are ok to the subject change (let me know if you are not), I'm
> attaching a new version of this patch that has changed the subject with my
> suggestion, and manually resolved the conflicts on mm-new, for Andrew's
> convenience. I also applied that to my tree (damon/next), and I will repost it
> if Andrew miss this (as we are in the middle of merge window, maintainers could
> miss many things).
>
> [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
>
>
> Thanks,
> SJ
>
> [...]
> ======= >8 =======
> From e09d66bb116604c9dc5b22540641e991d977ea6b Mon Sep 17 00:00:00 2001
> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> Date: Thu, 12 Feb 2026 09:43:26 +0000
> Subject: [PATCH] mm/damon/: remove unused target param of get_scheme_score()
>
> damon_target is not used by get_scheme_score operations, nor with
> virtual neither with physical addresses.
>
> Signed-off-by: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>
> Link: https://patch.msgid.link/20260212094326.906497-1-gutierrez.asier@huawei-partners.com
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> include/linux/damon.h | 3 +--
> mm/damon/core.c | 10 +++++-----
> mm/damon/paddr.c | 3 +--
> mm/damon/vaddr.c | 3 +--
> 4 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index a4fea23da8576..9a88cf8d152d8 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -647,8 +647,7 @@ struct damon_operations {
> void (*prepare_access_checks)(struct damon_ctx *context);
> unsigned int (*check_accesses)(struct damon_ctx *context);
> int (*get_scheme_score)(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme);
> + struct damon_region *r, struct damos *scheme);
> unsigned long (*apply_scheme)(struct damon_ctx *context,
> struct damon_target *t, struct damon_region *r,
> struct damos *scheme, unsigned long *sz_filter_passed);
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 5e2724a4f285e..925908415a041 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1679,15 +1679,15 @@ static bool __damos_valid_target(struct damon_region *r, struct damos *s)
> r->age <= s->pattern.max_age_region;
> }
>
> -static bool damos_valid_target(struct damon_ctx *c, struct damon_target *t,
> - struct damon_region *r, struct damos *s)
> +static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r,
> + struct damos *s)
> {
> bool ret = __damos_valid_target(r, s);
>
> if (!ret || !s->quota.esz || !c->ops.get_scheme_score)
> return ret;
>
> - return c->ops.get_scheme_score(c, t, r, s) >= s->quota.min_score;
> + return c->ops.get_scheme_score(c, r, s) >= s->quota.min_score;
> }
>
> /*
> @@ -2011,7 +2011,7 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
> s->max_nr_snapshots <= s->stat.nr_snapshots)
> continue;
>
> - if (damos_valid_target(c, t, r, s))
> + if (damos_valid_target(c, r, s))
> damos_apply_scheme(c, t, r, s);
>
> if (damon_is_last_region(r, t))
> @@ -2309,7 +2309,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> damon_for_each_region(r, t) {
> if (!__damos_valid_target(r, s))
> continue;
> - score = c->ops.get_scheme_score(c, t, r, s);
> + score = c->ops.get_scheme_score(c, r, s);
> c->regions_score_histogram[score] +=
> damon_sz_region(r);
> if (score > max_score)
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 9bfe488268407..5cdcc5037cbc1 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -343,8 +343,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
> }
>
> static int damon_pa_scheme_score(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme)
> + struct damon_region *r, struct damos *scheme)
> {
> switch (scheme->action) {
> case DAMOS_PAGEOUT:
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 83ab3d8c37920..4e3430d4191d1 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -986,8 +986,7 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx,
> }
>
> static int damon_va_scheme_score(struct damon_ctx *context,
> - struct damon_target *t, struct damon_region *r,
> - struct damos *scheme)
> + struct damon_region *r, struct damos *scheme)
> {
>
> switch (scheme->action) {
Yes, I will change the subject.
My bad, I didn't try the patch against mm-next. Indeed, as you
suggested, it doesn't compile. I will submit a new version
of this patch after checking it works with mm-next.
--
Asier Gutierrez
Huawei
^ permalink raw reply [flat|nested] 4+ messages in thread