[PATCH 02/10] mm/damon/core: use abs_diff() in damon_feed_loop_next_input()
From: SJ Park
Date: Thu Sep 17 2026 - 10:30:32 EST
damon_feed_loop_next_input() is open-coding absolute diff calculation
instead of the dedicated helper, abs_diff(), for no good reason. Use
the dedicated helper.
Signed-off-by: SJ Park <sj@xxxxxxxxxx>
---
mm/damon/core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 444c97c184027..de46072dc1a2f 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2926,10 +2926,7 @@ static unsigned long damon_feed_loop_next_input(unsigned long last_input,
if (score >= goal * 2)
return min_input;
- if (over_achieving)
- score_goal_diff = score - goal;
- else
- score_goal_diff = goal - score;
+ score_goal_diff = abs_diff(score, goal);
if (last_input < ULONG_MAX / score_goal_diff)
compensation = last_input * score_goal_diff / goal;
--
2.47.3