By calling damon_sysfs_turn_damon_on(), the execution of damon_commit_ctx() can be bypassed. Therefore, it is necessary to prevent ctx->addr_unit from being set to 0 in damon_sysfs_apply_inputs() and update min_region to avoid potential issues. Signed-off-by: Quanmin Yan --- mm/damon/sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index bea782b0a711..122824776c1d 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1422,7 +1422,8 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx, err = damon_select_ops(ctx, sys_ctx->ops_id); if (err) return err; - ctx->addr_unit = sys_ctx->addr_unit; + ctx->addr_unit = sys_ctx->addr_unit ? : 1; + ctx->min_region = max(DAMON_MIN_REGION / ctx->addr_unit, 1); err = damon_sysfs_set_attrs(ctx, sys_ctx->attrs); if (err) return err; -- 2.34.1