From: Tejun Heo Date: Tue, 6 Aug 2024 19:40:11 +0000 (-1000) Subject: sched_ext: Use update_curr_common() in update_curr_scx() X-Git-Tag: v6.12-rc1~111^2~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7799140b6a1697bf1d6ff80395079633f548f6e7;p=thirdparty%2Flinux.git 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 Suggested-by: Peter Zijlstra Acked-by: David Vernet --- diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 938830121a325..48f8f57f59547 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); }