[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <65e75c42-e846-c571-582f-b52938b26973@huawei.com>
Date: Wed, 15 Sep 2021 11:10:42 +0800
From: Zhang Qiao <zhangqiao22@...wei.com>
To: Tejun Heo <tj@...nel.org>
CC: <mingo@...hat.com>, <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<bristot@...hat.com>
Subject: Re: [PATCH v2] kernel/sched: Fix sched_fork() access an invalid
sched_task_group
在 2021/9/15 0:23, Tejun Heo 写道:
> On Tue, Sep 14, 2021 at 04:20:02PM +0800, Zhang Qiao wrote:
>> Perhaps we can fix this bug at sched_post_fork(), which is executed between cgroup_can_fork()
>> and cgroup_post_fork(). Relocate the fectching of task_group and access it at sched_post_fork().
>
> Can't we just add a can_fork callback in cpu_cgrp_subsys?
Because __set_task_cpu and task_fork callback need access the sched_task_group field, so the task_fork
callback must be called after update the child's sched_task_group, if perform these
operations in the newly added can_fork callback, it may lead to some dependencies(the can_fork will
not be executed when !CONFIG_CGROUP_SCHED).
__set_task_cpu and task_fork callback mainly do some field initialization and vruntime calculation,
these things just need to be done before waking up the new task. So i think it is no problem to defer
do this things at sched_post_fork().
thanks.
>
Powered by blists - more mailing lists