aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/damon/core.c9
-rw-r--r--mm/damon/sysfs-schemes.c10
2 files changed, 7 insertions, 12 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 7b06d926c552e..907f467fc8c00 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -300,15 +300,15 @@ void damos_destroy_filter(struct damos_filter *f)
}
struct damos_quota_goal *damos_new_quota_goal(
- unsigned long (*get_score)(void *), void *get_score_arg)
+ unsigned long target_value, unsigned long current_value)
{
struct damos_quota_goal *goal;
goal = kmalloc(sizeof(*goal), GFP_KERNEL);
if (!goal)
return NULL;
- goal->get_score = get_score;
- goal->get_score_arg = get_score_arg;
+ goal->target_value = target_value;
+ goal->current_value = current_value;
INIT_LIST_HEAD(&goal->list);
return goal;
}
@@ -1132,7 +1132,8 @@ static unsigned long damos_quota_score(struct damos_quota *quota)
damos_for_each_quota_goal(goal, quota)
highest_score = max(highest_score,
- goal->get_score(goal->get_score_arg));
+ goal->current_value * 10000 /
+ goal->target_value);
return highest_score;
}
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 7bf94b1ed6f7d..50218a7bfa0a6 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -1882,11 +1882,6 @@ static int damon_sysfs_set_scheme_filters(struct damos *scheme,
return 0;
}
-static unsigned long damos_sysfs_get_quota_score(void *arg)
-{
- return (unsigned long)arg;
-}
-
static int damos_sysfs_set_quota_score(
struct damos_sysfs_quota_goals *sysfs_goals,
struct damos_quota *quota)
@@ -1904,9 +1899,8 @@ static int damos_sysfs_set_quota_score(
if (!sysfs_goal->target_value)
continue;
- goal = damos_new_quota_goal(damos_sysfs_get_quota_score,
- (void *)(sysfs_goal->current_value * 10000 /
- sysfs_goal->target_value));
+ goal = damos_new_quota_goal(sysfs_goal->target_value,
+ sysfs_goal->current_value);
if (!goal)
return -ENOMEM;
damos_add_quota_goal(quota, goal);