]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/damon/core: replace per-quota regions priority histogram buffer usage with per...
authorSeongJae Park <sj@kernel.org>
Mon, 26 Aug 2024 04:23:21 +0000 (21:23 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Sep 2024 23:39:00 +0000 (16:39 -0700)
Replace the usage of per-quota region priorities histogram buffer with the
per-context one.  After this change, the per-quota histogram is not used
by anyone, and hence it is ready to be removed.

Link: https://lkml.kernel.org/r/20240826042323.87025-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/core.c

index 40266d85eebfd2ceda4843b139545898ed346356..8b99c5a99c385aa2b05bf2d37dcb1d26eb587b98 100644 (file)
@@ -1582,13 +1582,16 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
                return;
 
        /* Fill up the score histogram */
-       memset(quota->histogram, 0, sizeof(quota->histogram));
+       memset(c->regions_score_histogram, 0,
+                       sizeof(*c->regions_score_histogram) *
+                       (DAMOS_MAX_SCORE + 1));
        damon_for_each_target(t, c) {
                damon_for_each_region(r, t) {
                        if (!__damos_valid_target(r, s))
                                continue;
                        score = c->ops.get_scheme_score(c, t, r, s);
-                       quota->histogram[score] += damon_sz_region(r);
+                       c->regions_score_histogram[score] +=
+                               damon_sz_region(r);
                        if (score > max_score)
                                max_score = score;
                }
@@ -1596,7 +1599,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
 
        /* Set the min score limit */
        for (cumulated_sz = 0, score = max_score; ; score--) {
-               cumulated_sz += quota->histogram[score];
+               cumulated_sz += c->regions_score_histogram[score];
                if (cumulated_sz >= quota->esz || !score)
                        break;
        }