[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080901143007.9c623ef4.kamezawa.hiroyu@jp.fujitsu.com>
Date: Mon, 1 Sep 2008 14:30:07 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Pavel Emelianov <xemul@...nvz.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] res_counter: fix off-by-one bug in setting limit
On Mon, 01 Sep 2008 13:08:55 +0800
Li Zefan <lizf@...fujitsu.com> wrote:
> I found we can no longer set limit to 0 with 2.6.27-rcX:
> # mount -t cgroup -omemory xxx /mnt
> # mkdir /mnt/0
> # echo 0 > /mnt/0/memory.limit_in_bytes
> bash: echo: write error: Device or resource busy
>
> It turned out 'limit' can't be set to 'usage', which is wrong IMO.
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
But setting limit to 0(usage) in memcg is buggy operation unless you want to see OOM..
Hmm..
Thanks,
-Kame
> ---
> include/linux/res_counter.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
> index fdeadd9..271c1c2 100644
> --- a/include/linux/res_counter.h
> +++ b/include/linux/res_counter.h
> @@ -166,7 +166,7 @@ static inline int res_counter_set_limit(struct res_counter *cnt,
> int ret = -EBUSY;
>
> spin_lock_irqsave(&cnt->lock, flags);
> - if (cnt->usage < limit) {
> + if (cnt->usage <= limit) {
> cnt->limit = limit;
> ret = 0;
> }
> -- 1.5.4.rc3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists