Re: [RFC PATCH 14/27] mm/damon/paddr: support REPORT_MADE type probe filter

From: SJ Park

Date: Mon Nov 16 2026 - 10:05:56 EST


Hi Aveline,


On Mon, 16 Nov 2026 18:43:36 +1100 Aveline Noir <jm5905938@xxxxxxxxx> wrote:

> Hi SJ,
>
> On Sun, 15 Nov 2026 12:28:32 -0800 SJ Park wrote:
>
> > + case DAMON_FILTER_TYPE_REPORT_MADE:
> > + addr_range.start = pa;
> > + addr_range.end = pa + 1;
> > + matched = damon_report_exist(filter->report_type, &addr_range,
> > + jiffies -
> > + usecs_to_jiffies(ctx->attrs.sample_interval));
>
> Since the window is counted in jiffies and rounded up, how many samples
> see a given report depends on HZ. With the default 5 ms sampling
> interval, the window is 2 jiffies at HZ=250, i.e. 8 to 12 ms, so a
> report is usually seen by two consecutive samples. At HZ=1000 the
> window is 5 jiffies, but kdamond_usleep() sleeps via
> schedule_timeout_idle() there, and samples end up about 6 ms apart, so
> a report made right after a sample can fall out of the window before
> the next one.
>
> With the queue indexing fixed, user reports submitted every 50 or
> 250 ms and covering the whole physical address range were counted
> about 2.0 times each on an x86_64 guest at HZ=250, and about 0.84
> times at HZ=1000.

Thank you for sharing your thought and test results.

>
> Is this approximation intended?

Kind of intended. DAMON uses many approximations for low overhead and easy
maintenance, as long as the results are practical.

For this case, I'm not that scared about such over-counting. Users ain't
really care about the report counted just one more time. I'd rather expect
users repeatedly submit reports to make sure DAMON shows the memory as hot.

Also I believe users could tune intervals, manually or using the auto-tuning
feature.

> If each report is meant to be counted
> once, maybe we could keep a per-context report sequence cursor and
> check only the reports enqueued since the previous probe run. A quick
> local hack of that counted each report once on both HZ values. If
> reports are rather meant to stay valid for a while, like a user saying
> a range is hot, a validity period separate from the sampling interval
> might fit better.

If it turns out the approximation is real problem for users, we could consider
this kind of improvements.


Thanks,
SJ

[...]