From: Tejun Heo <htejun@gmail.com>
To: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Michal Hocko <mhocko@suse.cz>,
akpm@linux-foundation.org, mm-commits@vger.kernel.org,
liwanp@linux.vnet.ibm.com, Li Zefan <lizefan@huawei.com>,
cgroups mailinglist <cgroups@vger.kernel.org>,
linux-mm@kvack.org
Subject: Re: + hugetlb-cgroup-simplify-pre_destroy-callback.patch added to -mm tree
Date: Fri, 20 Jul 2012 19:46:57 -0700 [thread overview]
Message-ID: <20120721024657.GA7962@dhcp-172-17-108-109.mtv.corp.google.com> (raw)
In-Reply-To: <500A107D.9060404@jp.fujitsu.com>
Hello, Kamezawa-san.
On Sat, Jul 21, 2012 at 11:14:21AM +0900, Kamezawa Hiroyuki wrote:
> I'm sorry I misunderstand. The problem is following.
>
> CPU A CPU B
> mutex_unlock()
> mutex_lock()
> ->pre_destroy() attach task
> commit res->usage=0 mutex_unlock()
> increase res->usage
> detach task
> mutex_lock()
> check css's refcount=0
> ....continue destroy.
>
> Now, I thinks memcg's check is not enough but putting the -EBUSY there
> not to forget this race.
>
>
> I think a patch to stop task-attach and create child cgroup if CGRP_WAIT_ON_RMDIR
> is set is required. And that's enough..
The *ONLY* reason we're not marking the cgroup dead after the checking
whether the cgroup has children or task at the top of cgroup_rmdir()
is because memcg might fail ->pre_destroy() and cancel the cgroup
removal. We can't commit to removal because memcg might fail.
Now, if memcg drops the deprecated behavior, we can simply commit to
removal *before* starting calling pre_destroy() and it doesn't matter
at all whether we hold cgroup_mutex across pre_destroy or not and
cgroup core will simply deny any addition to the cgroup committed to
death. (and remove a handsome amount of ugly code in the process)
So, the *ONLY* reason this can't be fixed properly from cgroup core is
because memcg's pre_destory() might fail and it doesn't make much
sense to me to implement add a workaround at this point when the whole
problem will go away once memcg's pre_destroy() is updated.
So, please update memcg and drop the __DEPRECATED flag, so that the
cgroup core can drop at least this particular part of misdesign. :(
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-07-21 2:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120718212637.133475C0050@hpza9.eem.corp.google.com>
2012-07-19 11:39 ` Michal Hocko
2012-07-19 12:21 ` Aneesh Kumar K.V
2012-07-19 12:38 ` Michal Hocko
2012-07-19 13:48 ` Aneesh Kumar K.V
2012-07-19 14:09 ` [PATCH] cgroup: Don't drop the cgroup_mutex in cgroup_rmdir Aneesh Kumar K.V
2012-07-19 16:50 ` Tejun Heo
2012-07-20 15:45 ` Peter Zijlstra
2012-07-20 20:05 ` Tejun Heo
2012-07-20 22:07 ` Glauber Costa
2012-07-27 6:15 ` Li Zefan
2012-07-30 18:25 ` Tejun Heo
2012-07-20 7:51 ` Michal Hocko
2012-07-20 19:49 ` Tejun Heo
2012-07-20 1:05 ` + hugetlb-cgroup-simplify-pre_destroy-callback.patch added to -mm tree Kamezawa Hiroyuki
2012-07-20 1:20 ` Kamezawa Hiroyuki
2012-07-20 8:01 ` Michal Hocko
2012-07-20 8:08 ` Kamezawa Hiroyuki
2012-07-20 8:06 ` Michal Hocko
2012-07-20 19:18 ` Aneesh Kumar K.V
2012-07-20 19:56 ` Tejun Heo
2012-07-21 2:14 ` Kamezawa Hiroyuki
2012-07-21 2:46 ` Tejun Heo [this message]
2012-07-21 4:05 ` Kamezawa Hiroyuki
2012-07-22 17: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=20120721024657.GA7962@dhcp-172-17-108-109.mtv.corp.google.com \
--to=htejun@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=cgroups@vger.kernel.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=liwanp@linux.vnet.ibm.com \
--cc=lizefan@huawei.com \
--cc=mhocko@suse.cz \
--cc=mm-commits@vger.kernel.org \
/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