Skip to content

Commit 865d8cf

Browse files
johnstultz-workPeter Zijlstra
authored andcommitted
sched: Move update_curr_task logic into update_curr_se
Absorb update_curr_task() into update_curr_se(), and in the process simplify update_curr_common(). This will make the next step a bit easier. Signed-off-by: John Stultz <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: K Prateek Nayak <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a4f0b6f commit 865d8cf

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

kernel/sched/fair.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,14 @@ static s64 update_curr_se(struct rq *rq, struct sched_entity *curr)
11641164
curr->exec_start = now;
11651165
curr->sum_exec_runtime += delta_exec;
11661166

1167+
if (entity_is_task(curr)) {
1168+
struct task_struct *p = task_of(curr);
1169+
1170+
trace_sched_stat_runtime(p, delta_exec);
1171+
account_group_exec_runtime(p, delta_exec);
1172+
cgroup_account_cputime(p, delta_exec);
1173+
}
1174+
11671175
if (schedstat_enabled()) {
11681176
struct sched_statistics *stats;
11691177

@@ -1175,26 +1183,14 @@ static s64 update_curr_se(struct rq *rq, struct sched_entity *curr)
11751183
return delta_exec;
11761184
}
11771185

1178-
static inline void update_curr_task(struct task_struct *p, s64 delta_exec)
1179-
{
1180-
trace_sched_stat_runtime(p, delta_exec);
1181-
account_group_exec_runtime(p, delta_exec);
1182-
cgroup_account_cputime(p, delta_exec);
1183-
}
1184-
11851186
/*
11861187
* Used by other classes to account runtime.
11871188
*/
11881189
s64 update_curr_common(struct rq *rq)
11891190
{
11901191
struct task_struct *donor = rq->donor;
1191-
s64 delta_exec;
11921192

1193-
delta_exec = update_curr_se(rq, &donor->se);
1194-
if (likely(delta_exec > 0))
1195-
update_curr_task(donor, delta_exec);
1196-
1197-
return delta_exec;
1193+
return update_curr_se(rq, &donor->se);
11981194
}
11991195

12001196
/*
@@ -1219,10 +1215,6 @@ static void update_curr(struct cfs_rq *cfs_rq)
12191215
update_min_vruntime(cfs_rq);
12201216

12211217
if (entity_is_task(curr)) {
1222-
struct task_struct *p = task_of(curr);
1223-
1224-
update_curr_task(p, delta_exec);
1225-
12261218
/*
12271219
* If the fair_server is active, we need to account for the
12281220
* fair_server time whether or not the task is running on

0 commit comments

Comments
 (0)