Re: [PATCH 0/8] mm/damon: validate all parameters in the core

From: SJ Park

Date: Sun Jul 05 2026 - 12:46:21 EST


On Sun, 5 Jul 2026 08:55:51 -0700 SJ Park <sj@xxxxxxxxxx> wrote:

> DAMON has a number of parameters. Some of the parameters are validated
> by DAMON, while some are validated by DAMON API callers. Each caller
> has their own set of parameters that are exposed to users. Hence each
> caller has their own ways to do the validation. There is no clear lines
> for the responsibilities. It is confusing and easy to make mistakes at
> validations. Actually we found a few bugs in the class.
>
> Define DAMON core as the place to do all the validations and implement
> those. damon_set_regions(), damon_start() and damon_commit_ctx() are
> the three main DAMON core API functions for setup of DAMON parameters.
> Make the three functions to do safe and holistic parameter checks. The
> first one is already providing the validation, so changes are only for
> the last two functions.
>
> This might add unnecessary validations for some use cases. The overhead
> should be negligible as parameters update is expected to only rarely
> happen. It reduces the number of places to check and fix for bugs of
> the class from all callers to the single component. The maintenance
> efficiency gain is obvious.
>
> Further cleanup documents and caller code. Make the lines of validation
> duties clearer. Remove validations that are no more needed owing to the
> core validations.

Sashiko found a few things but those are not real issues in my opinion. Please
read my replies to Sashiko comments on DAMON mailing list thread [1].

DAMON mailing list is opted in to Sashiko finding mail delivery to the author
and the mailing list. I record my opinions to those by replying to the thread.
Hence you can show the detailed opinions from DAMON mailing list thread.

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


Thanks,
SJ

[...]