[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240716091550.GA26750@noisy.programming.kicks-ass.net>
Date: Tue, 16 Jul 2024 11:15:50 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Zhang Qiao <zhangqiao22@...wei.com>
Cc: mingo@...hat.com, juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
Markus.Elfring@....de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched: Initialize the vruntime of a new task when it
is first enqueued
On Thu, Jun 27, 2024 at 09:33:59PM +0800, Zhang Qiao wrote:
> When creating a new task, we initialize vruntime of the newly task at
> sched_cgroup_fork(). However, the timing of executing this action is too
> early and may not be accurate.
>
> Because it uses current CPU to init the vruntime, but the new task
> actually runs on the cpu which be assigned at wake_up_new_task().
>
> To optimize this case, we pass ENQUEUE_INITIAL flag to activate_task()
> in wake_up_new_task(), in this way, when place_entity is called in
> enqueue_entity(), the vruntime of the new task will be initialized.
>
> In addition, place_entity() in task_fork_fair() was introduced for two
> reasons:
> 1. Previously, the __enqueue_entity() was in task_new_fair(),
> in order to provide vruntime for enqueueing the newly task, the
> vruntime assignment equation "se->vruntime = cfs_rq->min_vruntime" was
> introduced by commit e9acbff6484d ("sched: introduce se->vruntime").
> This is the initial state of place_entity().
>
> 2. commit 4d78e7b656aa ("sched: new task placement for vruntime") added
> child_runs_first task placement feature which based on vruntime, this
> also requires the new task's vruntime value.
>
> After removing the child_runs_first and enqueue_entity() from
> task_fork_fair(), this place_entity() no longer makes sense, so remove
> it also.
>
> Signed-off-by: Zhang Qiao <zhangqiao22@...wei.com>
Thanks, I'll queue this for sched/urgent once -rc1 rolls around.
Powered by blists - more mailing lists