LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Zhang Qiao <zhangqiao22@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: <mingo@redhat.com>, <peterz@infradead.org>,
	<linux-kernel@vger.kernel.org>, <juri.lelli@redhat.com>,
	<vincent.guittot@linaro.org>, <dietmar.eggemann@arm.com>,
	<rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>,
	<bristot@redhat.com>
Subject: Re: [PATCH v2] kernel/sched: Fix sched_fork() access an invalid sched_task_group
Date: Wed, 15 Sep 2021 11:10:42 +0800	[thread overview]
Message-ID: <65e75c42-e846-c571-582f-b52938b26973@huawei.com> (raw)
In-Reply-To: <YUDMhMgM4ZECVBo8@slm.duckdns.org>



在 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.

> 

      reply	other threads:[~2021-09-15  3:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11  7:50 Zhang Qiao
2021-09-13 18:01 ` Tejun Heo
2021-09-14  8:20   ` Zhang Qiao
2021-09-14 16:23     ` Tejun Heo
2021-09-15  3:10       ` Zhang Qiao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65e75c42-e846-c571-582f-b52938b26973@huawei.com \
    --to=zhangqiao22@huawei.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --subject='Re: [PATCH v2] kernel/sched: Fix sched_fork() access an invalid sched_task_group' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).