From: Tejun Heo <tj@kernel.org>
To: Li Zefan <lizefan@huawei.com>
Cc: Oleg Nesterov <oleg@redhat.com>, anjana vk <anjanvk12@gmail.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
eunki_kim@samsung.com
Subject: Re: [PATCH] cgroup: fix to break the while loop in cgroup_attach_task() correctly
Date: Sun, 13 Oct 2013 16:08:16 -0400 [thread overview]
Message-ID: <20131013200816.GE18075@htj.dyndns.org> (raw)
In-Reply-To: <5258BB05.8030106@huawei.com>
On Sat, Oct 12, 2013 at 10:59:17AM +0800, Li Zefan wrote:
> From: Anjana V Kumar <anjanavk12@gmail.com>
>
> Both Anjana and Eunki reported a stall in the while_each_thread loop
> in cgroup_attach_task().
>
> It's because, when we attach a single thread to a cgroup, if the cgroup
> is exiting or is already in that cgroup, we won't break the loop.
>
> If the task is already in the cgroup, the bug can lead to another thread
> being attached to the cgroup unexpectedly:
>
> # echo 5207 > tasks
> # cat tasks
> 5207
> # echo 5207 > tasks
> # cat tasks
> 5207
> 5215
>
> What's worse, if the task to be attached isn't the leader of the thread
> group, we might never exit the loop, hence cpu stall. Thanks for Oleg's
> analysis.
>
> This bug was introduced by commit 081aa458c38ba576bdd4265fc807fa95b48b9e79
> ("cgroup: consolidate cgroup_attach_task() and cgroup_attach_proc()")
>
> Cc: <stable@vger.kernel.org> # 3.9+
> Reported-by: Eunki Kim <eunki_kim@samsung.com>
> Reported-by: Anjana V Kumar <anjanavk12@gmail.com>
> Signed-off-by: Anjana V Kumar <anjanavk12@gmail.com>
> [ lizf: - fixed the first continue, pointed out by Oleg,
> - rewrote changelog. ]
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Applied to cgroup/for-3.12-fixes.
Thanks.
--
tejun
next prev parent reply other threads:[~2013-10-13 20:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CALPf4Tz+Gf_Q7wKKBufCc1mtV1qVPVrOW0S1qhHxfOv6pJa2Kg@mail.gmail.com>
[not found] ` <20131004130207.GA9338@redhat.com>
[not found] ` <20131007184507.GD27396@htj.dyndns.org>
[not found] ` <20131008145833.GA15600@redhat.com>
[not found] ` <5254EB2A.7090803@huawei.com>
[not found] ` <20131009133047.GA12414@redhat.com>
[not found] ` <20131009140551.GA15849@redhat.com>
2013-10-09 16:54 ` cgroup_attach_task && while_each_thread (Was: cgroup attach task - slogging cpu) Oleg Nesterov
2013-10-11 13:15 ` Li Zefan
2013-10-11 16:00 ` Oleg Nesterov
2013-10-12 2:59 ` [PATCH] cgroup: fix to break the while loop in cgroup_attach_task() correctly Li Zefan
2013-10-13 20:08 ` Tejun Heo [this message]
2013-10-15 5:04 ` cgroup_attach_task && while_each_thread (Was: cgroup attach task - slogging cpu) anjana vk
2013-10-15 13:34 ` Tejun Heo
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=20131013200816.GE18075@htj.dyndns.org \
--to=tj@kernel.org \
--cc=anjanvk12@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=eunki_kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=oleg@redhat.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;
as well as URLs for NNTP newsgroup(s).