Re: [PATCH v3 0/2] mm/damon/core: Performance optimizations for the kdamond hot path
From: SeongJae Park
Date: Mon Mar 23 2026 - 10:30:31 EST
On Sun, 22 Mar 2026 21:43:23 +0000 Josh Law <objecting@xxxxxxxxxxxxx> wrote:
> Hello,
>
> This patch series provides two performance optimizations for the DAMON
> core, specifically targeting the hot paths in kdamond.
>
> The first patch optimizes kdamond_apply_schemes() by inverting the loop
> order. By iterating over schemes first and regions second, we can
> evaluate scheme-level invariants (like activation status and quotas)
> once per scheme rather than for every single region. This significantly
> reduces CPU overhead when multiple schemes are present or when quotas
> are reached.
>
> The second patch eliminates a hardware integer division in
> damon_max_nr_accesses() by using the pre-cached aggr_samples value.
> Since this function is called once per region per sampling interval,
> removing the division provides a measurable reduction in CPU cycles
> spent in the access rate update path.
>
> Changes from v2:
> - Fix multi-line if statement alignment in the first patch to satisfy
> checkpatch --strict.
>
> Changes from v1:
> - Use min_t(unsigned long, ...) in damon_max_nr_accesses() to satisfy
> checkpatch warnings and improve readability.
Thank you for adding the change log. Please also consider adding links [1] to
previous versions.
Also, please consider giving at least about one day before sending new revision
of a series, so that people can get a chance to review. If you find something
that you need to change on new version, you can comment first about your
planned change, and wait for others' comments.
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ
[...]