cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org, cgroups@vger.kernel.org,
	Li Zefan <lizefan@huawei.com>,
	kamezawa.hiroyu@jp.fujitsu.com,
	David Miller <davem@davemloft.net>,
	devel@openvz.org
Subject: Re: [PATCH 1/3] don't attach a task to a dead cgroup
Date: Fri, 20 Apr 2012 12:05:31 -0300	[thread overview]
Message-ID: <4F917B3B.1060704@parallels.com> (raw)
In-Reply-To: <20120419225322.GC10553@google.com>

On 04/19/2012 07:53 PM, Tejun Heo wrote:
> On Thu, Apr 19, 2012 at 07:49:16PM -0300, Glauber Costa wrote:
>> Not all external callers of cgroup_attach_task() test to
>> see if the cgroup is still live - the internal callers at
>> cgroup.c does.
>>
>> With this test in cgroup_attach_task, we can assure that
>> no tasks are ever moved to a cgroup that is past its
>> destruction point and was already marked as dead.
>>
>> Signed-off-by: Glauber Costa<glommer@parallels.com>
>> CC: Tejun Heo<tj@kernel.org>
>> CC: Li Zefan<lizefan@huawei.com>
>> CC: Kamezawa Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
>> ---
>>   kernel/cgroup.c |    3 +++
>>   1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
>> index b61b938..932c318 100644
>> --- a/kernel/cgroup.c
>> +++ b/kernel/cgroup.c
>> @@ -1927,6 +1927,9 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
>>   	struct cgroup_taskset tset = { };
>>   	struct css_set *newcg;
>>
>> +	if (cgroup_is_removed(cgrp))
>> +		return -ENODEV;
>> +
>
> Isn't the test in cgroup_lock_live_group() enough?
>
Yes, when it is done.

Not all callers take it, specially the external ones.

  reply	other threads:[~2012-04-20 15:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-19 22:49 [PATCH 0/3] Fix problem with static_key decrement Glauber Costa
     [not found] ` <1334875758-20939-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-19 22:49   ` [PATCH 1/3] don't attach a task to a dead cgroup Glauber Costa
     [not found]     ` <1334875758-20939-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-19 22:53       ` Tejun Heo
2012-04-20 15:05         ` Glauber Costa [this message]
2012-04-19 22:49   ` [PATCH 2/3] don't take cgroup_mutex in destroy() Glauber Costa
     [not found]     ` <1334875758-20939-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-19 22:57       ` Tejun Heo
     [not found]         ` <20120419225704.GE10553-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-04-20  0:30           ` Li Zefan
2012-04-20 15:04           ` Glauber Costa
     [not found]             ` <4F917AEB.7080404-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-21  6:47               ` Li Zefan
     [not found]                 ` <4F9257F4.2070505-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-04-23 16:36                   ` Glauber Costa
2012-04-19 22:49   ` [PATCH 3/3] decrement static keys on real destroy time Glauber Costa
     [not found]     ` <1334875758-20939-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-20  7:38       ` KAMEZAWA Hiroyuki
     [not found]         ` <4F911289.1050403-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-04-20 19:39           ` Glauber Costa
2012-04-19 22:54   ` [PATCH 0/3] Fix problem with static_key decrement Tejun Heo
     [not found]     ` <20120419225441.GD10553-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-04-20 15:01       ` Glauber Costa

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=4F917B3B.1060704@parallels.com \
    --to=glommer@parallels.com \
    --cc=cgroups@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lizefan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).