summaryrefslogtreecommitdiffstats
path: root/mm/damon/reclaim.c
diff options
context:
space:
mode:
authorXin Hao <xhao@linux.alibaba.com>2022-09-09 23:36:06 +0200
committerAndrew Morton <akpm@linux-foundation.org>2022-10-03 23:03:08 +0200
commit0d83b2d89dbfad17b62d4e7fb8f0b0525ba1a204 (patch)
tree3279b016f2c4e6dda4f968299a1ca14fdf9805e1 /mm/damon/reclaim.c
parentmm: kfence: convert to DEFINE_SEQ_ATTRIBUTE (diff)
downloadlinux-0d83b2d89dbfad17b62d4e7fb8f0b0525ba1a204.tar.xz
linux-0d83b2d89dbfad17b62d4e7fb8f0b0525ba1a204.zip
mm/damon: remove duplicate get_monitoring_region() definitions
In lru_sort.c and reclaim.c, they are all defining get_monitoring_region() function, there is no need to define it separately. As 'get_monitoring_region()' is not a 'static' function anymore, we try to use a prefix to distinguish with other functions, so there rename it to 'damon_find_biggest_system_ram'. Link: https://lkml.kernel.org/r/20220909213606.136221-1-sj@kernel.org Signed-off-by: Xin Hao <xhao@linux.alibaba.com> Signed-off-by: SeongJae Park <sj@kernel.org> Suggested-by: SeongJae Park <sj@kernel.org> Reviewed-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/damon/reclaim.c')
-rw-r--r--mm/damon/reclaim.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index 5aeca0b9e88e..fe7bc0c55ecb 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -229,39 +229,6 @@ module_param(nr_quota_exceeds, ulong, 0400);
static struct damon_ctx *ctx;
static struct damon_target *target;
-struct damon_reclaim_ram_walk_arg {
- unsigned long start;
- unsigned long end;
-};
-
-static int walk_system_ram(struct resource *res, void *arg)
-{
- struct damon_reclaim_ram_walk_arg *a = arg;
-
- if (a->end - a->start < resource_size(res)) {
- a->start = res->start;
- a->end = res->end;
- }
- return 0;
-}
-
-/*
- * Find biggest 'System RAM' resource and store its start and end address in
- * @start and @end, respectively. If no System RAM is found, returns false.
- */
-static bool get_monitoring_region(unsigned long *start, unsigned long *end)
-{
- struct damon_reclaim_ram_walk_arg arg = {};
-
- walk_system_ram_res(0, ULONG_MAX, &arg, walk_system_ram);
- if (arg.end <= arg.start)
- return false;
-
- *start = arg.start;
- *end = arg.end;
- return true;
-}
-
static struct damos *damon_reclaim_new_scheme(void)
{
struct damos_access_pattern pattern = {
@@ -328,8 +295,8 @@ static int damon_reclaim_apply_parameters(void)
if (monitor_region_start > monitor_region_end)
return -EINVAL;
if (!monitor_region_start && !monitor_region_end &&
- !get_monitoring_region(&monitor_region_start,
- &monitor_region_end))
+ !damon_find_biggest_system_ram(&monitor_region_start,
+ &monitor_region_end))
return -EINVAL;
addr_range.start = monitor_region_start;
addr_range.end = monitor_region_end;