Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation
From: SJ Park
Date: Wed Sep 02 2026 - 11:05:01 EST
On Wed, 2 Sep 2026 22:07:13 +0800 Kunwu Chan <kunwu.chan@xxxxxxxxx> wrote:
> On Tue, 1 Sep 2026 22:47:38 -0700 SJ Park <sj@xxxxxxxxxx> wrote:
[...]
> I was wondering whether DAMON_MAX_PROBES is purely a core invariant
> or also an interface constraint.
Thank you for reviewing my patch and raising this question!
>
> With this change, sysfs allows nr_probes larger than
> DAMON_MAX_PROBES and damon_sysfs_probes_add_dirs() will start creating
> probe objects before the configuration is later rejected by
> damon_valid_probe_params().
>
> Since nr_probes directly controls the number of sysfs objects created,
> do we still want to keep an early check here?
>
> I agree that the core validation is required for non-sysfs callers,
> but I am not sure whether this particular limit should be duplicated
> at the sysfs layer.
I agree the user experience may be not that good.
In my humble opinion, however, keeping code simplicity is more important than
the user experience here. After all, DAMON_SYSFS is recommended to be used by
another high level tools like DAMON user-space tool (damo) rather than human
fingers. The user-space tools like damo can do the early check.
Please feel free to let me know if you have any other opinions or questions.
Thanks,
SJ
[...]