From: SJ Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SJ Park <sj@kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH 1/3] mm/damon: add damon_region->last_probe_hits
Date: Fri, 3 Jul 2026 10:06:01 -0700 [thread overview]
Message-ID: <20260703170605.94472-2-sj@kernel.org> (raw)
In-Reply-To: <20260703170605.94472-1-sj@kernel.org>
Add new damon_region filed, last_probe_hits. Maintain fully accumulated
probe_hits values from the last aggregation interval in the field.
Signed-off-by: SJ Park <sj@kernel.org>
---
include/linux/damon.h | 2 +-
mm/damon/core.c | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 805e089ff4f2f..4f7e305b261c3 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -68,10 +68,10 @@ struct damon_region {
unsigned int nr_accesses;
unsigned char probe_hits[DAMON_MAX_PROBES];
struct list_head list;
-
unsigned int age;
/* private: Internal value for age calculation. */
unsigned int last_nr_accesses;
+ unsigned char last_probe_hits[DAMON_MAX_PROBES];
};
/**
diff --git a/mm/damon/core.c b/mm/damon/core.c
index b2fc15a3804ff..d45dc87fbbd9c 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -302,8 +302,10 @@ struct damon_region *damon_new_region(unsigned long start, unsigned long end)
region->ar.start = start;
region->ar.end = end;
region->nr_accesses = 0;
- for (i = 0; i < DAMON_MAX_PROBES; i++)
+ for (i = 0; i < DAMON_MAX_PROBES; i++) {
region->probe_hits[i] = 0;
+ region->last_probe_hits[i] = 0;
+ }
INIT_LIST_HEAD(®ion->list);
region->age = 0;
@@ -2047,8 +2049,10 @@ static void kdamond_reset_aggregated(struct damon_ctx *c)
damon_nr_regions(t), nr_probes);
r->last_nr_accesses = r->nr_accesses;
r->nr_accesses = 0;
- for (i = 0; i < DAMON_MAX_PROBES; i++)
+ for (i = 0; i < DAMON_MAX_PROBES; i++) {
+ r->last_probe_hits[i] = r->probe_hits[i];
r->probe_hits[i] = 0;
+ }
}
ti++;
}
@@ -3239,6 +3243,8 @@ static void damon_split_region_at(struct damon_target *t,
new->nr_accesses = r->nr_accesses;
/* todo: do this for only installed probes */
memcpy(new->probe_hits, r->probe_hits, sizeof(r->probe_hits));
+ memcpy(new->last_probe_hits, r->last_probe_hits,
+ sizeof(r->last_probe_hits));
damon_insert_region(new, r, damon_next_region(r), t);
}
--
2.47.3
next prev parent reply other threads:[~2026-07-03 17:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 17:06 [PATCH 0/3] mm/damon: provide pseudo moving sum probe_hits SJ Park
2026-07-03 17:06 ` SJ Park [this message]
2026-07-03 17:24 ` [PATCH 1/3] mm/damon: add damon_region->last_probe_hits sashiko-bot
2026-07-03 17:38 ` SJ Park
2026-07-03 17:06 ` [PATCH 2/3] mm/damon/core: introduce damon_probe_hits_mvsum() SJ Park
2026-07-03 17:06 ` [PATCH 3/3] mm/damon/sysfs-schemes: set probe hits as pseudo moving sums SJ Park
2026-07-03 17:26 ` sashiko-bot
2026-07-03 17:42 ` 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=20260703170605.94472-2-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.