From: Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2 2/6] sched: split out css_online/css_offline from tg creation/destruction
Date: Thu, 24 Jan 2013 11:01:34 +0100 [thread overview]
Message-ID: <20130124100134.GC26351@gmail.com> (raw)
In-Reply-To: <5100D518.8000103-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
* Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> wrote:
> This is a preparaton for later patches.
>
> - What do we gain from cpu_cgroup_css_online():
>
> After ss->css_alloc() and before ss->css_online(), there's a small
> window that tg->css.cgroup is NULL. With this change, tg won't be seen
> before ss->css_online(), where it's added to the global list, so we're
> guaranteed we'll never see NULL tg->css.cgroup.
>
> - What do we gain from cpu_cgroup_css_offline():
>
> tg is freed via RCU, so is cgroup. Without this change, This is how
> synchronization works:
>
> cgroup_rmdir()
> no ss->css_offline()
> diput()
> syncornize_rcu()
> ss->css_free() <-- unregister tg, and free it via call_rcu()
> kfree_rcu(cgroup) <-- wait possible refs to cgroup, and free cgroup
>
> We can't just kfree(cgroup), because tg might access tg->css.cgroup.
>
> With this change:
>
> cgroup_rmdir()
> ss->css_offline() <-- unregister tg
> diput()
> synchronize_rcu() <-- wait possible refs to tg and cgroup
> ss->css_free() <-- free tg
> kfree_rcu(cgroup) <-- free cgroup
>
> As you see, kfree_rcu() is redundant now.
>
> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Acked-by: Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Thanks,
Ingo
next prev parent reply other threads:[~2013-01-24 10:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 6:30 [PATCH v2 1/6] cgroup: initialize cgrp->dentry before css_alloc() Li Zefan
[not found] ` <5100D4FE.9080205-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-01-24 6:30 ` [PATCH v2 2/6] sched: split out css_online/css_offline from tg creation/destruction Li Zefan
[not found] ` <5100D518.8000103-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-01-24 10:01 ` Ingo Molnar [this message]
[not found] ` <20130124100134.GC26351-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-24 19:42 ` Tejun Heo
[not found] ` <20130124194205.GS2373-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-01-25 7:47 ` Ingo Molnar
2013-01-24 10:04 ` Ingo Molnar
[not found] ` <20130124100434.GD26351-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-25 1:38 ` Li Zefan
2013-01-24 6:31 ` [PATCH v2 3/6] sched: remove redundant NULL cgroup check in task_group_path() Li Zefan
2013-01-24 6:31 ` [PATCH v2 4/6] cgroup: remove duplicate RCU free on struct cgroup Li Zefan
2013-01-24 6:31 ` [PATCH v2 5/6] cgroup: remove synchronize_rcu() from cgroup_diput() Li Zefan
2013-01-24 6:32 ` [PATCH v2 6/6] cgroup: remove bogus comments in cgroup_diput() Li Zefan
[not found] ` <5100D562.6050407-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-01-24 21:49 ` Tejun Heo
[not found] ` <20130124214917.GU2373-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-01-25 2:27 ` Li Zefan
2013-01-24 20:06 ` [PATCH v2 1/6] cgroup: initialize cgrp->dentry before css_alloc() 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=20130124100134.GC26351@gmail.com \
--to=mingo-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@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 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).