summaryrefslogtreecommitdiff
path: root/mm/damon/core.c
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2024-02-19 11:44:18 -0800
committerAndrew Morton <akpm@linux-foundation.org>2024-02-23 17:48:27 -0800
commit106e26fc1c4c1a0e3747246e15df2bc3aa9d46b2 (patch)
tree44bd885a71315399d43fd215ff9ad36141cd0629 /mm/damon/core.c
parent4d791a0a2ab47d70131909942009f12f61db20ab (diff)
mm/damon/core: split out quota goal related fields to a struct
'struct damos_quota' is not small now. Split out fields for quota goal to a separate struct for easier reading. Link: https://lkml.kernel.org/r/20240219194431.159606-8-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/damon/core.c')
-rw-r--r--mm/damon/core.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 0656966a6fc4..fe4209672121 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1083,21 +1083,22 @@ static unsigned long damon_feed_loop_next_input(unsigned long last_input,
return min_input;
}
-/* Shouldn't be called if quota->ms, quota->sz, and quota->get_score unset */
+/* Called only if quota->ms, quota->sz, or quota->goal.get_score are set */
static void damos_set_effective_quota(struct damos_quota *quota)
{
unsigned long throughput;
unsigned long esz;
- if (!quota->ms && !quota->get_score) {
+ if (!quota->ms && !quota->goal.get_score) {
quota->esz = quota->sz;
return;
}
- if (quota->get_score) {
+ if (quota->goal.get_score) {
quota->esz_bp = damon_feed_loop_next_input(
max(quota->esz_bp, 10000UL),
- quota->get_score(quota->get_score_arg));
+ quota->goal.get_score(
+ quota->goal.get_score_arg));
esz = quota->esz_bp / 10000;
}
@@ -1107,7 +1108,7 @@ static void damos_set_effective_quota(struct damos_quota *quota)
quota->total_charged_ns;
else
throughput = PAGE_SIZE * 1024;
- if (quota->get_score)
+ if (quota->goal.get_score)
esz = min(throughput * quota->ms, esz);
else
esz = throughput * quota->ms;
@@ -1127,7 +1128,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
unsigned long cumulated_sz;
unsigned int score, max_score = 0;
- if (!quota->ms && !quota->sz && !quota->get_score)
+ if (!quota->ms && !quota->sz && !quota->goal.get_score)
return;
/* New charge window starts */