]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/damon/core: receive addr_unit on damon_set_region_biggest_system_ram_default()
authorSeongJae Park <sj@kernel.org>
Wed, 11 Mar 2026 05:29:24 +0000 (22:29 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:28 +0000 (13:53 -0700)
damon_find_biggest_system_ram() was not supporting addr_unit in the past.
Hence, its caller, damon_set_region_biggest_system_ram_default(), was also
not supporting addr_unit.  The previous commit has updated the inner
function to support addr_unit.  There is no more reason to not support
addr_unit on damon_set_region_biggest_system_ram_default().  Rather, it
makes unnecessary inconsistency on support of addr_unit.  Update it to
receive addr_unit and handle it inside.

Link: https://lkml.kernel.org/r/20260311052927.93921-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Yang yingliang <yangyingliang@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/damon.h
mm/damon/core.c
mm/damon/lru_sort.c
mm/damon/reclaim.c

index e44e2132ccaf63a35160c5a32f3cd960a152f72b..d9a3babbafc167472627531b23766e02cc95a7dd 100644 (file)
@@ -994,6 +994,7 @@ int damos_walk(struct damon_ctx *ctx, struct damos_walk_control *control);
 
 int damon_set_region_biggest_system_ram_default(struct damon_target *t,
                                unsigned long *start, unsigned long *end,
+                               unsigned long addr_unit,
                                unsigned long min_region_sz);
 
 #endif /* CONFIG_DAMON */
index f5f46ba5d537c394431d902a7215cfeb3f5996be..01c892a1dcd2badd9c02072863fd27f0b4e57349 100644 (file)
@@ -3110,6 +3110,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
  * @t:         The monitoring target to set the region.
  * @start:     The pointer to the start address of the region.
  * @end:       The pointer to the end address of the region.
+ * @addr_unit: The address unit for the damon_ctx of @t.
  * @min_region_sz:     Minimum region size.
  *
  * This function sets the region of @t as requested by @start and @end.  If the
@@ -3122,7 +3123,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
  */
 int damon_set_region_biggest_system_ram_default(struct damon_target *t,
                        unsigned long *start, unsigned long *end,
-                       unsigned long min_region_sz)
+                       unsigned long addr_unit, unsigned long min_region_sz)
 {
        struct damon_addr_range addr_range;
 
@@ -3130,12 +3131,12 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t,
                return -EINVAL;
 
        if (!*start && !*end &&
-               !damon_find_biggest_system_ram(start, end, 1))
+                       !damon_find_biggest_system_ram(start, end, addr_unit))
                return -EINVAL;
 
        addr_range.start = *start;
        addr_range.end = *end;
-       return damon_set_regions(t, &addr_range, 1, min_region_sz);
+       return damon_set_regions(t, &addr_range, addr_unit, min_region_sz);
 }
 
 /*
index 7bc5c0b2aea3e1bf55a5319301d0a58683789303..133ea17e258df3c9249397164607f8b5728b8b56 100644 (file)
@@ -345,6 +345,7 @@ static int damon_lru_sort_apply_parameters(void)
        err = damon_set_region_biggest_system_ram_default(param_target,
                                        &monitor_region_start,
                                        &monitor_region_end,
+                                       param_ctx->addr_unit,
                                        param_ctx->min_region_sz);
        if (err)
                goto out;
index 43d76f5bed44979980aae00244380343fb3b6be8..01f2f6cdbcdfeefcd40367d60aaf22e549f7d404 100644 (file)
@@ -251,6 +251,7 @@ static int damon_reclaim_apply_parameters(void)
        err = damon_set_region_biggest_system_ram_default(param_target,
                                        &monitor_region_start,
                                        &monitor_region_end,
+                                       param_ctx->addr_unit,
                                        param_ctx->min_region_sz);
        if (err)
                goto out;