@@ -197,15 +197,15 @@ static int damon_fill_regions_holes(struct damon_region *first,
197197 * @t: the given target.
198198 * @ranges: array of new monitoring target ranges.
199199 * @nr_ranges: length of @ranges.
200- * @min_sz_region : minimum region size.
200+ * @min_region_sz : minimum region size.
201201 *
202202 * This function adds new regions to, or modify existing regions of a
203203 * monitoring target to fit in specific ranges.
204204 *
205205 * Return: 0 if success, or negative error code otherwise.
206206 */
207207int damon_set_regions (struct damon_target * t , struct damon_addr_range * ranges ,
208- unsigned int nr_ranges , unsigned long min_sz_region )
208+ unsigned int nr_ranges , unsigned long min_region_sz )
209209{
210210 struct damon_region * r , * next ;
211211 unsigned int i ;
@@ -242,16 +242,16 @@ int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges,
242242 /* no region intersects with this range */
243243 newr = damon_new_region (
244244 ALIGN_DOWN (range -> start ,
245- min_sz_region ),
246- ALIGN (range -> end , min_sz_region ));
245+ min_region_sz ),
246+ ALIGN (range -> end , min_region_sz ));
247247 if (!newr )
248248 return - ENOMEM ;
249249 damon_insert_region (newr , damon_prev_region (r ), r , t );
250250 } else {
251251 /* resize intersecting regions to fit in this range */
252252 first -> ar .start = ALIGN_DOWN (range -> start ,
253- min_sz_region );
254- last -> ar .end = ALIGN (range -> end , min_sz_region );
253+ min_region_sz );
254+ last -> ar .end = ALIGN (range -> end , min_region_sz );
255255
256256 /* fill possible holes in the range */
257257 err = damon_fill_regions_holes (first , last , t );
@@ -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_SZ ;
549+ ctx -> min_region_sz = DAMON_MIN_REGION_SZ ;
550550
551551 INIT_LIST_HEAD (& ctx -> adaptive_targets );
552552 INIT_LIST_HEAD (& ctx -> schemes );
@@ -1131,7 +1131,7 @@ static struct damon_target *damon_nth_target(int n, struct damon_ctx *ctx)
11311131 * If @src has no region, @dst keeps current regions.
11321132 */
11331133static int damon_commit_target_regions (struct damon_target * dst ,
1134- struct damon_target * src , unsigned long src_min_sz_region )
1134+ struct damon_target * src , unsigned long src_min_region_sz )
11351135{
11361136 struct damon_region * src_region ;
11371137 struct damon_addr_range * ranges ;
@@ -1148,19 +1148,19 @@ static int damon_commit_target_regions(struct damon_target *dst,
11481148 i = 0 ;
11491149 damon_for_each_region (src_region , src )
11501150 ranges [i ++ ] = src_region -> ar ;
1151- err = damon_set_regions (dst , ranges , i , src_min_sz_region );
1151+ err = damon_set_regions (dst , ranges , i , src_min_region_sz );
11521152 kfree (ranges );
11531153 return err ;
11541154}
11551155
11561156static int damon_commit_target (
11571157 struct damon_target * dst , bool dst_has_pid ,
11581158 struct damon_target * src , bool src_has_pid ,
1159- unsigned long src_min_sz_region )
1159+ unsigned long src_min_region_sz )
11601160{
11611161 int err ;
11621162
1163- err = damon_commit_target_regions (dst , src , src_min_sz_region );
1163+ err = damon_commit_target_regions (dst , src , src_min_region_sz );
11641164 if (err )
11651165 return err ;
11661166 if (dst_has_pid )
@@ -1187,7 +1187,7 @@ static int damon_commit_targets(
11871187 err = damon_commit_target (
11881188 dst_target , damon_target_has_pid (dst ),
11891189 src_target , damon_target_has_pid (src ),
1190- src -> min_sz_region );
1190+ src -> min_region_sz );
11911191 if (err )
11921192 return err ;
11931193 } else {
@@ -1214,7 +1214,7 @@ static int damon_commit_targets(
12141214 return - ENOMEM ;
12151215 err = damon_commit_target (new_target , false,
12161216 src_target , damon_target_has_pid (src ),
1217- src -> min_sz_region );
1217+ src -> min_region_sz );
12181218 if (err ) {
12191219 damon_destroy_target (new_target , NULL );
12201220 return err ;
@@ -1261,7 +1261,7 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)
12611261 }
12621262 dst -> ops = src -> ops ;
12631263 dst -> addr_unit = src -> addr_unit ;
1264- dst -> min_sz_region = src -> min_sz_region ;
1264+ dst -> min_region_sz = src -> min_region_sz ;
12651265
12661266 return 0 ;
12671267}
@@ -1294,8 +1294,8 @@ static unsigned long damon_region_sz_limit(struct damon_ctx *ctx)
12941294
12951295 if (ctx -> attrs .min_nr_regions )
12961296 sz /= ctx -> attrs .min_nr_regions ;
1297- if (sz < ctx -> min_sz_region )
1298- sz = ctx -> min_sz_region ;
1297+ if (sz < ctx -> min_region_sz )
1298+ sz = ctx -> min_region_sz ;
12991299
13001300 return sz ;
13011301}
@@ -1673,7 +1673,7 @@ static bool damos_valid_target(struct damon_ctx *c, struct damon_target *t,
16731673 * @t: The target of the region.
16741674 * @rp: The pointer to the region.
16751675 * @s: The scheme to be applied.
1676- * @min_sz_region : minimum region size.
1676+ * @min_region_sz : minimum region size.
16771677 *
16781678 * If a quota of a scheme has exceeded in a quota charge window, the scheme's
16791679 * action would applied to only a part of the target access pattern fulfilling
@@ -1691,7 +1691,8 @@ static bool damos_valid_target(struct damon_ctx *c, struct damon_target *t,
16911691 * Return: true if the region should be entirely skipped, false otherwise.
16921692 */
16931693static bool damos_skip_charged_region (struct damon_target * t ,
1694- struct damon_region * * rp , struct damos * s , unsigned long min_sz_region )
1694+ struct damon_region * * rp , struct damos * s ,
1695+ unsigned long min_region_sz )
16951696{
16961697 struct damon_region * r = * rp ;
16971698 struct damos_quota * quota = & s -> quota ;
@@ -1713,11 +1714,11 @@ static bool damos_skip_charged_region(struct damon_target *t,
17131714 if (quota -> charge_addr_from && r -> ar .start <
17141715 quota -> charge_addr_from ) {
17151716 sz_to_skip = ALIGN_DOWN (quota -> charge_addr_from -
1716- r -> ar .start , min_sz_region );
1717+ r -> ar .start , min_region_sz );
17171718 if (!sz_to_skip ) {
1718- if (damon_sz_region (r ) <= min_sz_region )
1719+ if (damon_sz_region (r ) <= min_region_sz )
17191720 return true;
1720- sz_to_skip = min_sz_region ;
1721+ sz_to_skip = min_region_sz ;
17211722 }
17221723 damon_split_region_at (t , r , sz_to_skip );
17231724 r = damon_next_region (r );
@@ -1743,7 +1744,7 @@ static void damos_update_stat(struct damos *s,
17431744
17441745static bool damos_filter_match (struct damon_ctx * ctx , struct damon_target * t ,
17451746 struct damon_region * r , struct damos_filter * filter ,
1746- unsigned long min_sz_region )
1747+ unsigned long min_region_sz )
17471748{
17481749 bool matched = false;
17491750 struct damon_target * ti ;
@@ -1760,8 +1761,8 @@ static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t,
17601761 matched = target_idx == filter -> target_idx ;
17611762 break ;
17621763 case DAMOS_FILTER_TYPE_ADDR :
1763- start = ALIGN_DOWN (filter -> addr_range .start , min_sz_region );
1764- end = ALIGN_DOWN (filter -> addr_range .end , min_sz_region );
1764+ start = ALIGN_DOWN (filter -> addr_range .start , min_region_sz );
1765+ end = ALIGN_DOWN (filter -> addr_range .end , min_region_sz );
17651766
17661767 /* inside the range */
17671768 if (start <= r -> ar .start && r -> ar .end <= end ) {
@@ -1797,7 +1798,7 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t,
17971798
17981799 s -> core_filters_allowed = false;
17991800 damos_for_each_core_filter (filter , s ) {
1800- if (damos_filter_match (ctx , t , r , filter , ctx -> min_sz_region )) {
1801+ if (damos_filter_match (ctx , t , r , filter , ctx -> min_region_sz )) {
18011802 if (filter -> allow )
18021803 s -> core_filters_allowed = true;
18031804 return !filter -> allow ;
@@ -1932,7 +1933,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
19321933 if (c -> ops .apply_scheme ) {
19331934 if (quota -> esz && quota -> charged_sz + sz > quota -> esz ) {
19341935 sz = ALIGN_DOWN (quota -> esz - quota -> charged_sz ,
1935- c -> min_sz_region );
1936+ c -> min_region_sz );
19361937 if (!sz )
19371938 goto update_stat ;
19381939 damon_split_region_at (t , r , sz );
@@ -1980,7 +1981,7 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
19801981 if (quota -> esz && quota -> charged_sz >= quota -> esz )
19811982 continue ;
19821983
1983- if (damos_skip_charged_region (t , & r , s , c -> min_sz_region ))
1984+ if (damos_skip_charged_region (t , & r , s , c -> min_region_sz ))
19841985 continue ;
19851986
19861987 if (!damos_valid_target (c , t , r , s ))
@@ -2429,7 +2430,7 @@ static void damon_split_region_at(struct damon_target *t,
24292430
24302431/* Split every region in the given target into 'nr_subs' regions */
24312432static void damon_split_regions_of (struct damon_target * t , int nr_subs ,
2432- unsigned long min_sz_region )
2433+ unsigned long min_region_sz )
24332434{
24342435 struct damon_region * r , * next ;
24352436 unsigned long sz_region , sz_sub = 0 ;
@@ -2439,13 +2440,13 @@ static void damon_split_regions_of(struct damon_target *t, int nr_subs,
24392440 sz_region = damon_sz_region (r );
24402441
24412442 for (i = 0 ; i < nr_subs - 1 &&
2442- sz_region > 2 * min_sz_region ; i ++ ) {
2443+ sz_region > 2 * min_region_sz ; i ++ ) {
24432444 /*
24442445 * Randomly select size of left sub-region to be at
24452446 * least 10 percent and at most 90% of original region
24462447 */
24472448 sz_sub = ALIGN_DOWN (damon_rand (1 , 10 ) *
2448- sz_region / 10 , min_sz_region );
2449+ sz_region / 10 , min_region_sz );
24492450 /* Do not allow blank region */
24502451 if (sz_sub == 0 || sz_sub >= sz_region )
24512452 continue ;
@@ -2485,7 +2486,7 @@ static void kdamond_split_regions(struct damon_ctx *ctx)
24852486 nr_subregions = 3 ;
24862487
24872488 damon_for_each_target (t , ctx )
2488- damon_split_regions_of (t , nr_subregions , ctx -> min_sz_region );
2489+ damon_split_regions_of (t , nr_subregions , ctx -> min_region_sz );
24892490
24902491 last_nr_regions = nr_regions ;
24912492}
@@ -2855,7 +2856,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
28552856 * @t: The monitoring target to set the region.
28562857 * @start: The pointer to the start address of the region.
28572858 * @end: The pointer to the end address of the region.
2858- * @min_sz_region : Minimum region size.
2859+ * @min_region_sz : Minimum region size.
28592860 *
28602861 * This function sets the region of @t as requested by @start and @end. If the
28612862 * values of @start and @end are zero, however, this function finds the biggest
@@ -2867,7 +2868,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
28672868 */
28682869int damon_set_region_biggest_system_ram_default (struct damon_target * t ,
28692870 unsigned long * start , unsigned long * end ,
2870- unsigned long min_sz_region )
2871+ unsigned long min_region_sz )
28712872{
28722873 struct damon_addr_range addr_range ;
28732874
@@ -2880,7 +2881,7 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t,
28802881
28812882 addr_range .start = * start ;
28822883 addr_range .end = * end ;
2883- return damon_set_regions (t , & addr_range , 1 , min_sz_region );
2884+ return damon_set_regions (t , & addr_range , 1 , min_region_sz );
28842885}
28852886
28862887/*
0 commit comments