From: Tejun Heo <tj@kernel.org>
To: Zhang Qiao <zhangqiao22@huawei.com>
Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
lizefan.x@bytedance.com, hannes@cmpxchg.org, matthltc@us.ibm.com,
bblum@google.com, menage@google.com, akpm@linux-foundation.org,
longman@redhat.com, mkoutny@suse.com, zhaogongyi@huawei.com
Subject: Re: [PATCH] cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug
Date: Mon, 14 Feb 2022 09:50:39 -1000 [thread overview]
Message-ID: <Ygqyj7nns+mxH81t@slm.duckdns.org> (raw)
In-Reply-To: <20220121101210.84926-1-zhangqiao22@huawei.com>
On Fri, Jan 21, 2022 at 06:12:10PM +0800, Zhang Qiao wrote:
> As previously discussed(https://lkml.org/lkml/2022/1/20/51),
> cpuset_attach() is affected with similar cpu hotplug race,
> as follow scenario:
>
> cpuset_attach() cpu hotplug
> --------------------------- ----------------------
> down_write(cpuset_rwsem)
> guarantee_online_cpus() // (load cpus_attach)
> sched_cpu_deactivate
> set_cpu_active()
> // will change cpu_active_mask
> set_cpus_allowed_ptr(cpus_attach)
> __set_cpus_allowed_ptr_locked()
> // (if the intersection of cpus_attach and
> cpu_active_mask is empty, will return -EINVAL)
> up_write(cpuset_rwsem)
>
> To avoid races such as described above, protect cpuset_attach() call
> with cpu_hotplug_lock.
>
> Fixes: be367d099270 ("cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time")
> Reported-by: Zhao Gongyi <zhaogongyi@huawei.com>
> Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
Applied to cgroup/for-5.17-fixes w/ stable cc'd.
Thanks and sorry about the delay.
--
tejun
prev parent reply other threads:[~2022-02-14 20:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 10:12 Zhang Qiao
2022-01-21 12:43 ` Waiman Long
2022-01-22 7:54 ` Zhang Qiao
2022-01-21 15:57 ` Michal Koutný
2022-01-22 7:37 ` Zhang Qiao
2022-02-07 6:17 ` Zhang Qiao
2022-02-14 19:50 ` Tejun Heo [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=Ygqyj7nns+mxH81t@slm.duckdns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bblum@google.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
--cc=mkoutny@suse.com \
--cc=zhangqiao22@huawei.com \
--cc=zhaogongyi@huawei.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®