From: Paul Menage <menage@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>
Subject: Re: [RFC][PATCH 4/4] cgroup-memcg fix frequent EBUSY at rmdir v2
Date: Wed, 21 Jan 2009 02:00:56 -0800 [thread overview]
Message-ID: <6599ad830901210200q77b2553ag35f706c321a18d83@mail.gmail.com> (raw)
In-Reply-To: <20090120194735.cc52c5e0.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, Jan 20, 2009 at 2:47 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> CGRP_NOTIFY_ON_RELEASE,
> + /* Someone calls rmdir() and is wating for this cgroup is released */
/* A thread is in rmdir() waiting to destroy this cgroup */
Also document that it can only be set/cleared when you're holding the
inode_sem for the cgroup directory. And we should probably move this
enum inside cgroup.c, since nothing in the header file uses it.
> + CGRP_WAIT_ON_RMDIR,
> };
>
> struct cgroup {
> @@ -350,7 +352,7 @@ int cgroup_is_descendant(const struct cg
> struct cgroup_subsys {
> struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
> struct cgroup *cgrp);
> - void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
> + int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
Can you update the documentation to indicate what an error result from
pre_destroy indicates? Can pre_destroy() be called multiple times for
the same subsystem/cgroup?
> +
> + /* wake up rmdir() waiter....it should fail.*/
/* Wake up rmdir() waiter - the rmdir should fail since the cgroup is
no longer empty */
But is this safe? If we do a pre-destroy, is it OK to let new tasks
into the cgroup?
> @@ -2446,6 +2461,8 @@ static long cgroup_create(struct cgroup
>
> mutex_unlock(&cgroup_mutex);
> mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
> + if (wakeup_on_rmdir(parent))
> + cgroup_rmdir_wakeup_waiters();
I don't think that there can be a waiter, since rmdir() would hold the
parent's inode semaphore, which would block this thread before it gets
to cgroup_create()
> +DECLARE_WAIT_QUEUE_HEAD(cgroup_rmdir_waitq);
> +
> +static void cgroup_rmdir_wakeup_waiters(void)
> +{
> + wake_up_all(&cgroup_rmdir_waitq);
> +}
> +
I think you can merge wakeup_on_rmdir() and
cgroup_rmdir_wakeup_waiters() into a single function,
cgroup_wakeup_rmdir(struct cgroup *)
>
> + if (signal_pending(current))
> + return -EINTR;
I think it would be better to move this check to after we've already
failed on cgroup_clear_css_refs(). That way we can't fail with an
EINTR just because we raced with a signal on the way into rmdir() - we
have to actually hit the EBUSY and try to sleep.
> + ret = cgroup_call_pre_destroy(cgrp);
> + if (ret == -EBUSY)
> + return -EBUSY;
What about other potential error codes? If the subsystem's only
allowed to return 0 or EBUSY, then we should check for that.
Paul
--
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>
next prev parent reply other threads:[~2009-01-21 10:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-08 9:25 [RFC][PATCH] cgroup and memcg updates 20090108 KAMEZAWA Hiroyuki
2009-01-08 9:28 ` [RFC][PATCH 1/4] cgroup: support per cgroup subsys state ID (CSS ID) KAMEZAWA Hiroyuki
2009-01-09 3:59 ` Li Zefan
2009-01-09 4:24 ` KAMEZAWA Hiroyuki
2009-01-10 0:23 ` Paul Menage
2009-01-10 0:49 ` KAMEZAWA Hiroyuki
2009-01-12 7:21 ` Balbir Singh
2009-01-15 6:12 ` KAMEZAWA Hiroyuki
2009-01-13 7:40 ` Li Zefan
2009-01-13 9:22 ` KAMEZAWA Hiroyuki
2009-01-08 9:30 ` [RFC][PATCH 2/4] memcg: use CSS ID in memcg KAMEZAWA Hiroyuki
2009-01-12 12:14 ` Balbir Singh
2009-01-15 6:19 ` KAMEZAWA Hiroyuki
2009-01-08 9:32 ` [RFC][PATCH 3/4] memcg: fix OOM KILL under hierarchy KAMEZAWA Hiroyuki
2009-01-13 8:33 ` Li Zefan
2009-01-13 9:25 ` KAMEZAWA Hiroyuki
2009-01-08 9:35 ` [RFC][PATCH 4/4] cgroup-memcg fix frequent EBUSY at rmdir KAMEZAWA Hiroyuki
2009-01-14 2:48 ` Paul Menage
2009-01-14 3:00 ` KAMEZAWA Hiroyuki
2009-01-14 3:05 ` Paul Menage
2009-01-14 3:12 ` KAMEZAWA Hiroyuki
2009-01-20 10:47 ` [RFC][PATCH 4/4] cgroup-memcg fix frequent EBUSY at rmdir v2 KAMEZAWA Hiroyuki
2009-01-21 10:00 ` Paul Menage [this message]
2009-01-21 10:32 ` KAMEZAWA Hiroyuki
2009-01-21 10:43 ` Paul Menage
2009-01-21 10:45 ` 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=6599ad830901210200q77b2553ag35f706c321a18d83@mail.gmail.com \
--to=menage@google.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).