Re: [PATCH 2/2] mm/damon/sysfs-schemes: report the number of tried regions

From: SJ Park

Date: Mon Jul 27 2026 - 10:43:40 EST


Hello Jiayuan,

On Mon, 27 Jul 2026 17:54:23 +0800 Jiayuan Chen <jiayuan.chen@xxxxxxxxx> wrote:

> From: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
>
> The 'tried_regions' directory of each DAMON sysfs scheme exposes the memory
> regions that the scheme's action has been tried to be applied to, as
> per-region subdirectories. It also has a 'total_bytes' file that reports
> the total size of those regions without materializing the per-region
> subdirectories, so that users can cheaply retrieve the aggregated result.
>
> The number of the tried regions is another useful aggregated metric. When
> the scheme's access pattern is not restrictive, it approximates the number
> of the adaptive monitoring regions of the context, which users may want to
> watch, e.g., to see how well the monitoring is refined under a given
> max_nr_regions, or to feed fleet wide access pattern dashboards.
> Retrieving it currently requires materializing all the per-region
> subdirectories (via writing 'update_schemes_tried_regions') and counting
> them, which is unnecessarily expensive for users that only need the count.

I agree the number can be useful.

>
> Add a 'nr_regions' file to the 'tried_regions' directory. Like
> 'total_bytes', it is updated by both 'update_schemes_tried_bytes' and
> 'update_schemes_tried_regions', so it can be read as a lightweight counter
> without materializing the per-region subdirectories.

You could also get a similar information from DAMOS stat, specifically via
nr_tried stat. Have you considered using that?

I'm holding reviewing detail before this high level discussion is done.


Thanks,
SJ

[...]