Re: [PATCH -next] sched: Add update_current_exec_runtime helper

From: Peter Zijlstra
Date: Wed Aug 24 2022 - 02:39:29 EST


On Wed, Aug 24, 2022 at 02:53:26PM +0800, Shang XiaoJing wrote:

In general I like, however:

> diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c
> index d04073a93eb4..027068779126 100644
> --- a/kernel/sched/stop_task.c
> +++ b/kernel/sched/stop_task.c
> @@ -80,11 +80,7 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
> schedstat_set(curr->stats.exec_max,
> max(curr->stats.exec_max, delta_exec));
>
> - curr->se.sum_exec_runtime += delta_exec;
> - account_group_exec_runtime(curr, delta_exec);
> -
> - curr->se.exec_start = rq_clock_task(rq);
> - cgroup_account_cputime(curr, delta_exec);
> + update_current_exec_runtime(curr, rq_clock_task(rq), delta_exec);
> }

This already has a rq_clock_task() invocation; please fix it to call it
once -- pre-existing issue, but if we're cleaning up we should clean up,
right :-)