Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon: rename DAMON_MIN_REGION to DAMON_MIN_REGION_SZ

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>

authored by

SeongJae Park and committed by
Andrew Morton
dfb1b0c9 52c5d3ee

+18 -18
+1 -1
include/linux/damon.h
··· 15 15 #include <linux/random.h> 16 16 17 17 /* 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 19 19 /* Max priority score for DAMON-based operation schemes */ 20 20 #define DAMOS_MAX_SCORE (99) 21 21
+1 -1
mm/damon/core.c
··· 553 553 ctx->attrs.max_nr_regions = 1000; 554 554 555 555 ctx->addr_unit = 1; 556 - ctx->min_sz_region = DAMON_MIN_REGION; 556 + ctx->min_sz_region = DAMON_MIN_REGION_SZ; 557 557 558 558 INIT_LIST_HEAD(&ctx->adaptive_targets); 559 559 INIT_LIST_HEAD(&ctx->schemes);
+1 -1
mm/damon/lru_sort.c
··· 298 298 if (!monitor_region_start && !monitor_region_end) 299 299 addr_unit = 1; 300 300 param_ctx->addr_unit = addr_unit; 301 - param_ctx->min_sz_region = max(DAMON_MIN_REGION / addr_unit, 1); 301 + param_ctx->min_sz_region = max(DAMON_MIN_REGION_SZ / addr_unit, 1); 302 302 303 303 if (!damon_lru_sort_mon_attrs.sample_interval) { 304 304 err = -EINVAL;
+1 -1
mm/damon/reclaim.c
··· 208 208 if (!monitor_region_start && !monitor_region_end) 209 209 addr_unit = 1; 210 210 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); 212 212 213 213 if (!damon_reclaim_mon_attrs.aggr_interval) { 214 214 err = -EINVAL;
+1 -1
mm/damon/sysfs.c
··· 1470 1470 /* addr_unit is respected by only DAMON_OPS_PADDR */ 1471 1471 if (sys_ctx->ops_id == DAMON_OPS_PADDR) 1472 1472 ctx->min_sz_region = max( 1473 - DAMON_MIN_REGION / sys_ctx->addr_unit, 1); 1473 + DAMON_MIN_REGION_SZ / sys_ctx->addr_unit, 1); 1474 1474 err = damon_sysfs_set_attrs(ctx, sys_ctx->attrs); 1475 1475 if (err) 1476 1476 return err;
+1 -1
mm/damon/tests/vaddr-kunit.h
··· 147 147 damon_add_region(r, t); 148 148 } 149 149 150 - damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION); 150 + damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION_SZ); 151 151 152 152 for (i = 0; i < nr_expected / 2; i++) { 153 153 r = __nth_region_of(t, i);
+12 -12
mm/damon/vaddr.c
··· 19 19 #include "ops-common.h" 20 20 21 21 #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 24 24 #endif 25 25 26 26 /* ··· 78 78 79 79 orig_end = r->ar.end; 80 80 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); 82 82 83 83 if (!sz_piece) 84 84 return -EINVAL; ··· 161 161 swap(first_gap, second_gap); 162 162 163 163 /* 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); 170 170 171 171 return 0; 172 172 } ··· 259 259 sz += regions[i].end - regions[i].start; 260 260 if (ctx->attrs.min_nr_regions) 261 261 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; 264 264 265 265 /* Set the initial three regions of the target */ 266 266 for (i = 0; i < 3; i++) { ··· 299 299 damon_for_each_target(t, ctx) { 300 300 if (damon_va_three_regions(t, three_regions)) 301 301 continue; 302 - damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION); 302 + damon_set_regions(t, three_regions, 3, DAMON_MIN_REGION_SZ); 303 303 } 304 304 } 305 305