[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52FAD36F.7000500@huawei.com>
Date: Wed, 12 Feb 2014 09:50:39 +0800
From: Li Zefan <lizefan@...wei.com>
To: Michal Hocko <mhocko@...e.cz>
CC: Tejun Heo <tj@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH] cgroup: protect modifications to cgroup_idr with cgroup_mutex
On 2014/2/11 18:20, Michal Hocko wrote:
> Hi Li,
> good work in reproducing the issue so quickly!
> I have tried to backport this patch to 3.12 kernel but the code has
> changed since then.
> The only two instances of idr_remove which are called outside of
> cgroup_mutex seem to be:
> - cgroup_create calling it from err_free_id: path
> - css_free_work_fn
> mem_cgroup_css_free
> __mem_cgroup_free
> free_css_id
>
> The second one takes ss->id_lock spinlock which should be sufficient
> to exclude get_new_cssid but cgroup_mount and cgroup_create don't use
> id_lock. They do hold cgroup_mutex though. So I guess I need something
> like the following (I will have it tested):
I don't think you need to do anything with ss->idr.
cgroup_create() calls alloc_css_id() -> get_new_cssid(), and get_new_cssid()
uses id_lock.
cgroup_mount() won't touch ss->idr, because the css_id for root cgroup is
always 0.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists