Re: [PATCH] mm/damon/core: reject empty access pattern intervals on scheme commit
From: Aveline Noir
Date: Tue Nov 03 2026 - 07:56:51 EST
Hi Xiaolei,
On Tue, 03 Nov 2026 18:54:18 +0800 Xiaolei Wang (Kaihong) wrote:
> At runtime __damos_valid_target() evaluates "min <= x <= max" for each
> of the three pattern dimensions. A reversed interval is an empty set,
> so every region fails the check and the scheme silently never matches
> anything: nr_tried stays zero forever while the kdamond keeps running
> normally.
My understanding is that DAMON just does what the user asked for here,
so this looks more like an input validation improvement than a bug fix.
Since previously accepted input would now fail with -EINVAL, maybe drop
the Fixes: and Cc: stable tags, and mention the behavior change in the
changelog?
> The same holds for the watermarks thresholds, which must be monotonic
> (low <= mid <= high).
Not for all cases, I think. With mid > high (and low <= high), the
scheme still works; mid just has no effect. The subject would also
need to mention watermarks.
> + if (p->min_sz_region > p->max_sz_region ||
> + p->min_nr_accesses > p->max_nr_accesses ||
> + p->min_age_region > p->max_age_region)
> + return -EINVAL;
As Sashiko pointed out, this would break the DAMON sysfs.py selftest,
which uses size=[4096, 2**10]. Maybe update it together, and also add
a kunit case and a note in the DAMON usage document?
Thanks,
Aveline Noir