mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 04:03:23 -04:00
mm/damon/core: introduce damon_probe_hits_mvsum()
Implement a function for getting a reasonable best effort quality pseudo moving sums of probe_hits on demands. It reuses the internal function for the pseudo moving sum for data access frequency (nr_accesses). Link: https://lore.kernel.org/20260703170605.94472-3-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
@@ -1003,6 +1003,8 @@ void damon_add_probe(struct damon_ctx *ctx, struct damon_probe *probe);
|
||||
struct damon_region *damon_new_region(unsigned long start, unsigned long end);
|
||||
unsigned int damon_nr_accesses_mvsum(struct damon_region *r,
|
||||
struct damon_ctx *ctx);
|
||||
unsigned char damon_probe_hits_mvsum(int probe_idx, struct damon_region *r,
|
||||
struct damon_ctx *ctx);
|
||||
|
||||
int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges,
|
||||
unsigned int nr_ranges, unsigned long min_region_sz);
|
||||
|
||||
@@ -273,6 +273,27 @@ unsigned int damon_nr_accesses_mvsum(struct damon_region *r,
|
||||
left_window_bp);
|
||||
}
|
||||
|
||||
unsigned char damon_probe_hits_mvsum(int probe_idx, struct damon_region *r,
|
||||
struct damon_ctx *ctx)
|
||||
{
|
||||
unsigned long sample_interval, aggr_interval;
|
||||
unsigned long window_len, left_window, left_window_bp;
|
||||
|
||||
sample_interval = ctx->attrs.sample_interval ? : 1;
|
||||
aggr_interval = ctx->attrs.aggr_interval ? : 1;
|
||||
window_len = aggr_interval / sample_interval;
|
||||
if (time_after_eq(ctx->passed_sample_intervals,
|
||||
ctx->next_aggregation_sis))
|
||||
left_window = 0;
|
||||
else
|
||||
left_window = ctx->next_aggregation_sis -
|
||||
ctx->passed_sample_intervals;
|
||||
left_window_bp = mult_frac(left_window, 10000, window_len);
|
||||
|
||||
return damon_mvsum(r->probe_hits[probe_idx],
|
||||
r->last_probe_hits[probe_idx], left_window_bp);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DAMON_DEBUG_SANITY
|
||||
static void damon_verify_new_region(unsigned long start, unsigned long end)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user