linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: "Frederic Weisbecker" <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>, "Mel Gorman" <mgorman@suse.de>,
	"David Rientjes" <rientjes@google.com>,
	"缪 勰" <miaox@cn.fujitsu.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH] cgroup: fix race between fork and cgroup freezing
Date: Thu, 8 Mar 2012 10:26:22 -0800	[thread overview]
Message-ID: <20120308182622.GC25508@google.com> (raw)
In-Reply-To: <4F587199.6050404@cn.fujitsu.com>

Hello, Li, Frederic.

On Thu, Mar 08, 2012 at 04:45:13PM +0800, Li Zefan wrote:
> +static void freezer_post_fork(struct cgroup_subsys *ss,
> +			      struct task_struct *task)
> +{
> +	struct freezer *freezer;
> +
> +	cgroup_lock();
> +
> +	freezer = task_freezer(task);
> +	if (!freezer->css.cgroup->parent)
> +		goto out;
> +
> +	spin_lock_irq(&freezer->lock);
> +	if (freezer->state != CGROUP_THAWED)
> +		freeze_task(task);
> +	spin_unlock_irq(&freezer->lock);
> +out:
> +	cgroup_unlock();
> +}

Urgh... this is requiring policy implementations to synchronize with
problem caused by cgroup core optimization and it's so very subtle.
IMHO, this definitely should be contained in cgroup core and in a very
confined form even inside cgroup core.

Any other ideas?

Thanks.

-- 
tejun

  reply	other threads:[~2012-03-08 18:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08  8:45 [RFC][PATCH] cgroup: fix race between fork and cgroup freezing Li Zefan
2012-03-08 18:26 ` Tejun Heo [this message]
2012-03-09  6:26   ` Li Zefan
2012-03-09 16:53     ` Tejun Heo
2012-03-12  9:02       ` Li Zefan
2012-03-12 16:10         ` Tejun Heo
2012-03-19 13:44           ` Frederic Weisbecker
2012-03-19 15:05 ` Frederic Weisbecker

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=20120308182622.GC25508@google.com \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mgorman@suse.de \
    --cc=miaox@cn.fujitsu.com \
    --cc=rientjes@google.com \
    /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).