summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2023-11-06 14:04:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-14 20:00:19 +0100
commit24617f9ca8c82a9a0b89169a909a26b9751a31e2 (patch)
tree9f5918fd12bf7b14ee833bcb2c2ea5264598a8e4 /kernel
parent7f509457773e2d358f451c3057e065e7289f3eb7 (diff)
downloadlinux-24617f9ca8c82a9a0b89169a909a26b9751a31e2.tar.gz
linux-24617f9ca8c82a9a0b89169a909a26b9751a31e2.tar.bz2
linux-24617f9ca8c82a9a0b89169a909a26b9751a31e2.zip
sched: Unify more update_curr*()
[ Upstream commit c708a4dc5ab547edc3d6537233ca9e79ea30ce47 ] Now that trace_sched_stat_runtime() no longer takes a vruntime argument, the task specific bits are identical between update_curr_common() and update_curr(). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Stable-dep-of: 0664e2c311b9 ("sched/deadline: Fix warning in migrate_enable for boosted tasks") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 062447861d8e..3b2cfdb8d788 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1173,6 +1173,13 @@ static s64 update_curr_se(struct rq *rq, struct sched_entity *curr)
return delta_exec;
}
+static inline void update_curr_task(struct task_struct *p, s64 delta_exec)
+{
+ trace_sched_stat_runtime(p, delta_exec);
+ account_group_exec_runtime(p, delta_exec);
+ cgroup_account_cputime(p, delta_exec);
+}
+
/*
* Used by other classes to account runtime.
*/
@@ -1182,12 +1189,8 @@ s64 update_curr_common(struct rq *rq)
s64 delta_exec;
delta_exec = update_curr_se(rq, &curr->se);
- if (unlikely(delta_exec <= 0))
- return delta_exec;
-
- trace_sched_stat_runtime(curr, delta_exec);
- account_group_exec_runtime(curr, delta_exec);
- cgroup_account_cputime(curr, delta_exec);
+ if (likely(delta_exec > 0))
+ update_curr_task(curr, delta_exec);
return delta_exec;
}
@@ -1211,13 +1214,8 @@ static void update_curr(struct cfs_rq *cfs_rq)
update_deadline(cfs_rq, curr);
update_min_vruntime(cfs_rq);
- if (entity_is_task(curr)) {
- struct task_struct *curtask = task_of(curr);
-
- trace_sched_stat_runtime(curtask, delta_exec);
- cgroup_account_cputime(curtask, delta_exec);
- account_group_exec_runtime(curtask, delta_exec);
- }
+ if (entity_is_task(curr))
+ update_curr_task(task_of(curr), delta_exec);
account_cfs_rq_runtime(cfs_rq, delta_exec);
}