From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: [RFC PATCH 2/2] mm/damon/ops-common: use probe hits weighted sum for hotness
Date: Sun, 29 Nov 2026 16:15:29 -0800 [thread overview]
Message-ID: <20261130001530.173703-3-sj@kernel.org> (raw)
In-Reply-To: <20261130001530.173703-1-sj@kernel.org>
DAMOS finds memory that is eligible to apply the action, using DAMOS
core filters and target access pattern. If the total amount of the
eligible memory is larger than DAMOS quota, DAMOS selects memory to
apply the action based on their hotness and the action type. For
migrate_hot action, warmer regions are selected. For migrate_cold
action, colder regions are selected.
The hotness is calculated using the age and the access frequency. The
frequency is counted in damon_region->nr_accesses. When DAMON is
configured with data attribute probes and probe weights, it runs in
attributes-only monitoring mode. In the mode, the traditional access
frequency monitoring is skipped and therefore the access frequency
counter is not updated.
The prioritization logic will show all regions as having zero access
frequency. For actions that prefer hot regions such as migrate_hot,
regions of shorter age will be prioritized. For actions that prefer
cold regions such as migrate_cold and pageout, regions of longer age
will be prioritized. No real access frequency or the attributes
monitoring results are considered. It is only chaotic and useless.
In the attribute-only mode, probe hits weighted sum plays the role that
is similar to that of the traditional access frequency. The adaptive
region adjustment logic uses it in the attributes only mode. Do the
same for the DAMOS quota region prioritization purpose hotness
calculation. Replace the access frequency with the probe hits weighted
sum for the hotness calculation in the mode.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/ops-common.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index 2216a0023154..9197ead1c96b 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -168,6 +168,7 @@ void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
struct damos *s)
{
+ unsigned int nr_events;
int freq_subscore;
u64 age_in_sec;
int age_in_log, age_subscore;
@@ -175,8 +176,12 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
unsigned int age_weight = s->quota.weight_age;
int hotness;
- freq_subscore = mult_frac(damon_nr_accesses_mvsum(r, c),
- DAMON_MAX_SUBSCORE,
+ if (damon_has_probe_weights(c))
+ nr_events = damon_probe_hits_wsum(r, false, true, c);
+ else
+ nr_events = damon_nr_accesses_mvsum(r, c);
+
+ freq_subscore = mult_frac(nr_events, DAMON_MAX_SUBSCORE,
damon_nr_samples_per_aggr(&c->attrs));
age_in_sec = div_u64((u64)r->age * c->attrs.aggr_interval,
--
2.47.3
next prev parent reply other threads:[~2026-11-30 0:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 0:15 [RFC PATCH 0/2] mm/damon: improve DAMOS quota region prioritization in attr-only mode SJ Park
2026-11-30 0:15 ` [RFC PATCH 1/2] mm/damon/core: expose damon_has_probe_weights() SJ Park
2026-11-30 0:15 ` SJ Park [this message]
2026-11-30 0:27 ` [RFC PATCH 2/2] mm/damon/ops-common: use probe hits weighted sum for hotness sashiko-bot
2026-11-30 0:47 ` SJ Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130001530.173703-3-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox