linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Paul Menage <menage@google.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/4] cgroup:add css_is_populated
Date: Tue, 20 Jan 2009 11:58:32 +0900	[thread overview]
Message-ID: <20090120115832.0881506c.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <6599ad830901191823q556faeeub28d02d39dda7396@mail.gmail.com>

On Mon, 19 Jan 2009 18:23:03 -0800
Paul Menage <menage@google.com> wrote:

> On Mon, Jan 19, 2009 at 6:02 PM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > Ah, this is related to CSS ID scanning. No real problem to current codes.
> >
> > Now, in my patch, CSS ID is attached just after create().
> >
> > Then, "scan by CSS ID" can find a cgroup which is not populated yet.
> > I just wanted to skip them for avoiding mess.
> >
> > For example, css_tryget() can succeed against css which belongs to not-populated
> > cgroup. If creation of cgroup fails, it's destroyed and freed without RCU synchronize.
> > This may breaks CSS ID scanning's assumption that "we're safe under rcu_read_lock".
> > And allows destroy css while css->refcnt > 1.
> 
> So for the CSS ID case, we could solve this by not populating
> css_id->css until creation is guaranteed to have succeeded? (We'd
> still allocated the css_id along with the subsystem, just not complete
> its initialization). cgroup.c already knows about and hides the
> details of css_id, so this wouldn't be hard.
> 

Hmm, moving this call to after populate is not good because
id > max_id cannot be handled ;)

> +               if (ss->use_id)
> +                       if (alloc_css_id(ss, parent, cgrp))
> +                               goto err_destroy;
> +               /* At error, ->destroy() callback has to free assigned ID. */
>        }

Should I delay to set css_id->css pointer to valid value until the end of
populate() ? (add populage_css_id() call after cgroup_populate_dir()).

I'd like to write add-on patch to the patch [1/4]. (or update it.)
css_id->css == NULL case is handled now, anyway.



> The question is whether other users of css_tryget() might run into
> this problem, without using CSS IDs. But currently no-one's using
> css_tryget() apart from you, so that's a problem we can solve as it
> arises.
> 
yes ;)

> I think we're safe from css_get() being used in this case, since
> css_get() can only be used on css references obtained from a locked
> task, or from other pointers that are known to be ref-counted, which
> would be impossible if css_tryget() can't succeed on a css in the
> partially-completed state.
> 
> 

Thanks, I'll try some other patch. Maybe it's ok to delay updating css_id->css
pointer.

-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-01-20  2:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 10:21 [PATCH 0/4] cgroup/memcg : updates related to CSS KAMEZAWA Hiroyuki
2009-01-15 10:25 ` [PATCH 1/4] cgroup: add CSS ID KAMEZAWA Hiroyuki
2009-01-16  1:18   ` Li Zefan
2009-01-20  1:57   ` Paul Menage
2009-01-22  2:37   ` Daisuke Nishimura
2009-01-22  2:59     ` KAMEZAWA Hiroyuki
2009-01-15 10:27 ` [PATCH 2/4] cgroup:add css_is_populated KAMEZAWA Hiroyuki
2009-01-16  3:00   ` KAMEZAWA Hiroyuki
2009-01-20  1:41     ` Paul Menage
2009-01-20  1:51       ` Li Zefan
2009-01-20  1:55         ` Paul Menage
2009-01-20  1:39   ` Paul Menage
2009-01-20  2:02     ` KAMEZAWA Hiroyuki
2009-01-20  2:23       ` Paul Menage
2009-01-20  2:58         ` KAMEZAWA Hiroyuki [this message]
2009-01-20  5:43           ` [PATCH 1.5/4] cgroup: delay populate css id KAMEZAWA Hiroyuki
2009-01-21  9:36             ` Paul Menage
2009-01-21 10:34               ` KAMEZAWA Hiroyuki
2009-01-22  2:06                 ` KAMEZAWA Hiroyuki
2009-01-22  2:13                   ` Paul Menage
2009-01-15 10:29 ` [PATCH 3/4] memcg: hierarchical reclaim by CSS ID KAMEZAWA Hiroyuki
2009-01-16  1:29   ` Li Zefan
2009-01-16  1:38     ` KAMEZAWA Hiroyuki
2009-01-16  1:49       ` Li Zefan
2009-01-16  1:58         ` KAMEZAWA Hiroyuki
2009-01-16  2:22         ` KAMEZAWA Hiroyuki
2009-01-16  7:35           ` Li Zefan
2009-01-16  7:49             ` KAMEZAWA Hiroyuki
2009-01-15 10:32 ` [PATCH 4/4] memcg : read_statistics update to show total score KAMEZAWA Hiroyuki
2009-01-15 10:51 ` [PATCH 0/4] cgroup/memcg : updates related to CSS Balbir Singh
2009-01-15 10:58   ` KAMEZAWA Hiroyuki

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=20090120115832.0881506c.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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