Re: [PATCH 11/11] mm/damon: add damon_ctx->min_region

From: Quanmin Yan
Date: Thu Aug 21 2025 - 21:29:22 EST



在 2025/8/22 1:33, SeongJae Park 写道:
On Thu, 21 Aug 2025 18:51:59 +0800 Quanmin Yan <yanquanmin1@xxxxxxxxxx> wrote:

Adopting addr_unit would make DAMON_MINREGION 'addr_unit * 4096'
bytes and cause data alignment issues[1].

Add damon_ctx->min_region to change DAMON_MIN_REGION from a global
s/min_region/min_sz_region/ ?

macro value to per-context variable.

[1] https://lore.kernel.org/all/527714dd-0e33-43ab-bbbd-d89670ba79e7@xxxxxxxxxx

Signed-off-by: Quanmin Yan <yanquanmin1@xxxxxxxxxx>
---
include/linux/damon.h | 4 ++-
mm/damon/core.c | 67 ++++++++++++++++++++----------------
mm/damon/sysfs.c | 8 +++--
mm/damon/tests/core-kunit.h | 21 ++++++-----
mm/damon/tests/vaddr-kunit.h | 2 +-
mm/damon/vaddr.c | 2 +-
6 files changed, 61 insertions(+), 43 deletions(-)
[...]
@@ -1248,6 +1253,7 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)
}
dst->ops = src->ops;
dst->addr_unit = src->addr_unit;
+ dst->min_sz_region = max(DAMON_MIN_REGION / src->addr_unit, 1);
Can't we set this as src->min_sz_region?

I asked a same question[1] to the previous version but seems it was missed.

I apologize for the issues caused by my misunderstanding and carelessness.
I will make adjustments and release the v2 version as soon as possible, and I
will not make similar mistakes again in the future.


Best regards,
Quanmin Yan


[...]

Other parts look good to me.

[1] https://lore.kernel.org/20250820215612.86678-1-sj@xxxxxxxxxx


Thanks,
SJ