From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] cgroup: protect modifications to cgroup_idr with cgroup_mutex
Date: Wed, 12 Feb 2014 09:50:39 +0800 [thread overview]
Message-ID: <52FAD36F.7000500@huawei.com> (raw)
In-Reply-To: <20140211102032.GA11946-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
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.
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizefan@huawei.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: Tejun Heo <tj@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Cgroups <cgroups@vger.kernel.org>
Subject: Re: [PATCH] cgroup: protect modifications to cgroup_idr with cgroup_mutex
Date: Wed, 12 Feb 2014 09:50:39 +0800 [thread overview]
Message-ID: <52FAD36F.7000500@huawei.com> (raw)
In-Reply-To: <20140211102032.GA11946@dhcp22.suse.cz>
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.
next prev parent reply other threads:[~2014-02-12 1:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 8:05 [PATCH] cgroup: protect modifications to cgroup_idr with cgroup_mutex Li Zefan
2014-02-11 8:05 ` Li Zefan
[not found] ` <52F9D9DA.7040108-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-02-11 10:20 ` Michal Hocko
2014-02-11 10:20 ` Michal Hocko
[not found] ` <20140211102032.GA11946-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2014-02-12 1:50 ` Li Zefan [this message]
2014-02-12 1:50 ` Li Zefan
2014-02-12 9:12 ` Michal Hocko
2014-02-12 9:26 ` Li Zefan
[not found] ` <52FB3E50.8020809-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-02-12 9:38 ` Michal Hocko
2014-02-12 9:38 ` Michal Hocko
2014-02-11 15:36 ` Tejun Heo
2014-02-11 15:36 ` Tejun Heo
2014-02-11 15:41 ` [PATCH cgroup/for-3.14-fixes] " Tejun Heo
2014-02-11 15:41 ` Tejun Heo
2014-02-11 16:26 ` Michal Hocko
[not found] ` <20140211162625.GP11946-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2014-02-12 2:15 ` Li Zefan
2014-02-12 2:15 ` Li Zefan
[not found] ` <52FAD958.6020505-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-02-12 2:32 ` Li Zefan
2014-02-12 2:32 ` Li Zefan
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=52FAD36F.7000500@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.