Skip to content

Commit e4f13f7

Browse files
sjp38gregkh
authored andcommitted
mm/damon: rename DAMON_MIN_REGION to DAMON_MIN_REGION_SZ
[ Upstream commit dfb1b0c ] The macro is for the default minimum size of each DAMON region. There was a case that a reader was confused if it is the minimum number of total DAMON regions, which is set on damon_attrs->min_nr_regions. Make the name more explicit. Link: https://lkml.kernel.org/r/20260117175256.82826-8-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Stable-dep-of: c80f46a ("mm/damon/core: disallow non-power of two min_region_sz") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5549611 commit e4f13f7

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

include/linux/damon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/random.h>
1616

1717
/* Minimal region size. Every damon_region is aligned by this. */
18-
#define DAMON_MIN_REGION PAGE_SIZE
18+
#define DAMON_MIN_REGION_SZ PAGE_SIZE
1919
/* Max priority score for DAMON-based operation schemes */
2020
#define DAMOS_MAX_SCORE (99)
2121

mm/damon/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ struct damon_ctx *damon_new_ctx(void)
546546
ctx->attrs.max_nr_regions = 1000;
547547

548548
ctx->addr_unit = 1;
549-
ctx->min_sz_region = DAMON_MIN_REGION;
549+
ctx->min_sz_region = DAMON_MIN_REGION_SZ;
550550

551551
INIT_LIST_HEAD(&ctx->adaptive_targets);
552552
INIT_LIST_HEAD(&ctx->schemes);

mm/damon/lru_sort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int damon_lru_sort_apply_parameters(void)
212212
if (!monitor_region_start && !monitor_region_end)
213213
addr_unit = 1;
214214
param_ctx->addr_unit = addr_unit;
215-
param_ctx->min_sz_region = max(DAMON_MIN_REGION / addr_unit, 1);
215+
param_ctx->min_sz_region = max(DAMON_MIN_REGION_SZ / addr_unit, 1);
216216

217217
if (!damon_lru_sort_mon_attrs.sample_interval) {
218218
err = -EINVAL;

mm/damon/reclaim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int damon_reclaim_apply_parameters(void)
208208
if (!monitor_region_start && !monitor_region_end)
209209
addr_unit = 1;
210210
param_ctx->addr_unit = addr_unit;
211-
param_ctx->min_sz_region = max(DAMON_MIN_REGION / addr_unit, 1);
211+
param_ctx->min_sz_region = max(DAMON_MIN_REGION_SZ / addr_unit, 1);
212212

213213
if (!damon_reclaim_mon_attrs.aggr_interval) {
214214
err = -EINVAL;

mm/damon/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
14701470
/* addr_unit is respected by only DAMON_OPS_PADDR */
14711471
if (sys_ctx->ops_id == DAMON_OPS_PADDR)
14721472
ctx->min_sz_region = max(
1473-
DAMON_MIN_REGION / sys_ctx->addr_unit, 1);
1473+
DAMON_MIN_REGION_SZ / sys_ctx->addr_unit, 1);
14741474
err = damon_sysfs_set_attrs(ctx, sys_ctx->attrs);
14751475
if (err)
14761476
return err;

mm/damon/tests/vaddr-kunit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static void damon_do_test_apply_three_regions(struct kunit *test,
147147
damon_add_region(r, t);
148148
}
149149

150-
damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION);
150+
damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION_SZ);
151151

152152
for (i = 0; i < nr_expected / 2; i++) {
153153
r = __nth_region_of(t, i);

mm/damon/vaddr.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "ops-common.h"
2020

2121
#ifdef CONFIG_DAMON_VADDR_KUNIT_TEST
22-
#undef DAMON_MIN_REGION
23-
#define DAMON_MIN_REGION 1
22+
#undef DAMON_MIN_REGION_SZ
23+
#define DAMON_MIN_REGION_SZ 1
2424
#endif
2525

2626
/*
@@ -78,7 +78,7 @@ static int damon_va_evenly_split_region(struct damon_target *t,
7878

7979
orig_end = r->ar.end;
8080
sz_orig = damon_sz_region(r);
81-
sz_piece = ALIGN_DOWN(sz_orig / nr_pieces, DAMON_MIN_REGION);
81+
sz_piece = ALIGN_DOWN(sz_orig / nr_pieces, DAMON_MIN_REGION_SZ);
8282

8383
if (!sz_piece)
8484
return -EINVAL;
@@ -161,12 +161,12 @@ static int __damon_va_three_regions(struct mm_struct *mm,
161161
swap(first_gap, second_gap);
162162

163163
/* Store the result */
164-
regions[0].start = ALIGN(start, DAMON_MIN_REGION);
165-
regions[0].end = ALIGN(first_gap.start, DAMON_MIN_REGION);
166-
regions[1].start = ALIGN(first_gap.end, DAMON_MIN_REGION);
167-
regions[1].end = ALIGN(second_gap.start, DAMON_MIN_REGION);
168-
regions[2].start = ALIGN(second_gap.end, DAMON_MIN_REGION);
169-
regions[2].end = ALIGN(prev->vm_end, DAMON_MIN_REGION);
164+
regions[0].start = ALIGN(start, DAMON_MIN_REGION_SZ);
165+
regions[0].end = ALIGN(first_gap.start, DAMON_MIN_REGION_SZ);
166+
regions[1].start = ALIGN(first_gap.end, DAMON_MIN_REGION_SZ);
167+
regions[1].end = ALIGN(second_gap.start, DAMON_MIN_REGION_SZ);
168+
regions[2].start = ALIGN(second_gap.end, DAMON_MIN_REGION_SZ);
169+
regions[2].end = ALIGN(prev->vm_end, DAMON_MIN_REGION_SZ);
170170

171171
return 0;
172172
}
@@ -259,8 +259,8 @@ static void __damon_va_init_regions(struct damon_ctx *ctx,
259259
sz += regions[i].end - regions[i].start;
260260
if (ctx->attrs.min_nr_regions)
261261
sz /= ctx->attrs.min_nr_regions;
262-
if (sz < DAMON_MIN_REGION)
263-
sz = DAMON_MIN_REGION;
262+
if (sz < DAMON_MIN_REGION_SZ)
263+
sz = DAMON_MIN_REGION_SZ;
264264

265265
/* Set the initial three regions of the target */
266266
for (i = 0; i < 3; i++) {
@@ -299,7 +299,7 @@ static void damon_va_update(struct damon_ctx *ctx)
299299
damon_for_each_target(t, ctx) {
300300
if (damon_va_three_regions(t, three_regions))
301301
continue;
302-
damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION);
302+
damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION_SZ);
303303
}
304304
}
305305

0 commit comments

Comments
 (0)