public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] mm/damon/core: Performance optimizations for the kdamond hot path
@ 2026-03-22 21:43 Josh Law
  2026-03-22 21:43 ` [PATCH v3 1/2] mm/damon/core: optimize kdamond_apply_schemes() by inverting scheme and region loops Josh Law
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Josh Law @ 2026-03-22 21:43 UTC (permalink / raw)
  To: sj, akpm; +Cc: damon, linux-mm, linux-kernel, Josh Law

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.

Josh Law (2):
  mm/damon/core: optimize kdamond_apply_schemes() by inverting scheme
    and region loops
  mm/damon/core: eliminate hot-path integer division in
    damon_max_nr_accesses()

 include/linux/damon.h |  3 +-
 mm/damon/core.c       | 68 ++++++++++++++++++-------------------------
 2 files changed, 29 insertions(+), 42 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-24  7:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-22 21:43 [PATCH v3 0/2] mm/damon/core: Performance optimizations for the kdamond hot path Josh Law
2026-03-22 21:43 ` [PATCH v3 1/2] mm/damon/core: optimize kdamond_apply_schemes() by inverting scheme and region loops Josh Law
2026-03-23 14:07   ` SeongJae Park
2026-03-22 21:43 ` [PATCH v3 2/2] mm/damon/core: eliminate hot-path integer division in damon_max_nr_accesses() Josh Law
2026-03-23 14:10   ` SeongJae Park
2026-03-24  7:19   ` SeongJae Park
2026-03-24  7:22     ` Josh Law
2026-03-23 14:06 ` [PATCH v3 0/2] mm/damon/core: Performance optimizations for the kdamond hot path SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox