From: Li Zefan <lizf@cn.fujitsu.com>
To: "IKEDA, Munehiro" <m-ikeda@ds.jp.nec.com>
Cc: menage@google.com, balbir@linux.vnet.ibm.com,
Linux Containers <containers@lists.linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: memory.force_empty can make system slowdown
Date: Sun, 17 Aug 2008 09:15:39 +0800 [thread overview]
Message-ID: <48A77BBB.7050305@cn.fujitsu.com> (raw)
In-Reply-To: <48A63AD1.3010907@ds.jp.nec.com>
IKEDA, Munehiro wrote:
> Cgroup's memory controller has a control file "memory.force_empty"
> to reset usage account charged to a cgroup. The account shouldn't
> be reset if one or more processes are attached to the cgroup (at
> least for memory controller, IMHO). So mem_cgroup_force_empty()
> is implemented to return -EBUSY and do nothing if so.
> However, cgroup on hierarchy root faultily might be a exception.
> Even if processes are attached to root cgroup (which is a "default"
> cgroup for processes), forcing-empty can run by writing something to
> memory.force_empty and it'll never end.
>
I found this bug last week, and I've made patches to fix it, but then
I was on vacation. I'll send the patches out soon.
> Following patch prevents this issue.
>
> This patch is for cgroup infrastructure code. The issue can be
> measured by modifying memory controller code also, namely to change
> mem_cgroup_force_empty() to see CSS_ROOT bit of css->flags.
> I believe cgroup->count approach like the patch below is rather
> generic and reasonable, how does that sound?
>
It's ok for the top_group's count to be 0 due to the top_cgroup hack.
With this patch, the top cgroup's count will be always >0, even if it
has no tasks in it, so writing to top_cgroup's force_empty will always
return -EBUSY.
> Paul, Balbir?
>
>
>
> Signed-off-by: Munehiro "Muuhh" Ikeda <m-ikeda@ds.jp.nec.com>
>
> diff -uNrp linux-2.6.27-rc3.orig/kernel/cgroup.c linux-2.6.27-rc3/kernel/cgroup.c
> --- linux-2.6.27-rc3.orig/kernel/cgroup.c 2008-08-12 21:55:39.000000000 -0400
> +++ linux-2.6.27-rc3/kernel/cgroup.c 2008-08-15 20:52:52.000000000 -0400
> @@ -2264,8 +2264,10 @@ static void init_cgroup_css(struct cgrou
> css->cgroup = cgrp;
> atomic_set(&css->refcnt, 0);
> css->flags = 0;
> - if (cgrp == dummytop)
> + if (cgrp == dummytop) {
> set_bit(CSS_ROOT, &css->flags);
> + atomic_set(&css->cgroup->count, 1);
> + }
> BUG_ON(cgrp->subsys[ss->subsys_id]);
> cgrp->subsys[ss->subsys_id] = css;
> }
>
>
>
next prev parent reply other threads:[~2008-08-17 1:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 2:26 [PATCH] cgroup: memory.force_empty can make system slowdown IKEDA, Munehiro
2008-08-17 1:15 ` Li Zefan [this message]
2008-08-17 3:10 ` Li Zefan
[not found] ` <48A77BBB.7050305-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-08-17 3:10 ` Li Zefan
[not found] ` <48A63AD1.3010907-MDRzhb/z0dd8UrSeD/g0lQ@public.gmane.org>
2008-08-17 1:15 ` Li Zefan
-- strict thread matches above, loose matches on Subject: below --
2008-08-16 2:26 IKEDA, Munehiro
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=48A77BBB.7050305@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m-ikeda@ds.jp.nec.com \
--cc=menage@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.