[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240804024047.100355-4-tj@kernel.org>
Date: Sat, 3 Aug 2024 16:40:10 -1000
From: Tejun Heo <tj@...nel.org>
To: void@...ifault.com,
peterz@...radead.org
Cc: linux-kernel@...r.kernel.org,
kernel-team@...a.com,
mingo@...hat.com,
Tejun Heo <tj@...nel.org>
Subject: [PATCH 3/6] sched_ext: Use update_curr_common() in update_curr_scx()
update_curr_scx() is open coding runtime updates. Use update_curr_common()
instead and avoid unnecessary deviations.
Signed-off-by: Tejun Heo <tj@...nel.org>
Suggested-by: Peter Zijlstra <peterz@...radead.org>
---
kernel/sched/ext.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 938830121a32..48f8f57f5954 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -1466,20 +1466,14 @@ static void touch_core_sched_dispatch(struct rq *rq, struct task_struct *p)
static void update_curr_scx(struct rq *rq)
{
struct task_struct *curr = rq->curr;
- u64 now = rq_clock_task(rq);
- u64 delta_exec;
+ s64 delta_exec;
- if (time_before_eq64(now, curr->se.exec_start))
+ delta_exec = update_curr_common(rq);
+ if (unlikely(delta_exec <= 0))
return;
- delta_exec = now - curr->se.exec_start;
- curr->se.exec_start = now;
- curr->se.sum_exec_runtime += delta_exec;
- account_group_exec_runtime(curr, delta_exec);
- cgroup_account_cputime(curr, delta_exec);
-
if (curr->scx.slice != SCX_SLICE_INF) {
- curr->scx.slice -= min(curr->scx.slice, delta_exec);
+ curr->scx.slice -= min_t(u64, curr->scx.slice, delta_exec);
if (!curr->scx.slice)
touch_core_sched(rq, curr);
}
--
2.46.0
Powered by blists - more mailing lists