Linux Container Development
 help / color / mirror / Atom feed
From: Balbir Singh <balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
	menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC][PATCH] allow "unlimited" limit value.
Date: Wed, 26 Sep 2007 00:51:59 +0530	[thread overview]
Message-ID: <46F95FD7.3010204@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.DEB.0.9999.0709251205390.19001-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>

David Rientjes wrote:
> On Wed, 26 Sep 2007, KAMEZAWA Hiroyuki wrote:
> 
>>>> #define RES_COUNTER_INIFINITY 		(~0ULL)
>>>> or some nice name
>>> Why do we need this at all? We can simply push -1 there and be happy.
>>>
>> Hm, can this work now ?
>> ==
>> echo -1 > /cgroup/memory.limit_in_bytes
>> ==
>> Or users have to do following for unlimit resource ?
>> ==
>> echo some-very-very-big-number > /cgroup/memory.limit_in_bytes
>>
>>
>> I just think when some special value "-1" has a nice nick name, users will
>> be happy. If I'm a novice user, I don't imagine I can write -1 to limit value.
>> (but ok, tools can hide it for them.)
>>
> 
> Please simply use 0 to denote unconstrained memory, it's quite obvious 
> that nobody will sanely attach tasks to a cgroup that has no bytes of 
> memory allowed.
> 

Yes, I prefer 0 as well and had that in a series in the Lost World
of my earlier memory/RSS controller patches. I feel now that 0 is
a bit confusing, we don't use 0 to mean unlimited, unless we
treat the memory.limit_in_bytes value as boolean. 0 is false,
meaning there is no limit, > 0 is true, which means the limit
is set and the value is specified to the value read out.

> diff --git a/kernel/res_counter.c b/kernel/res_counter.c
> --- a/kernel/res_counter.c
> +++ b/kernel/res_counter.c
> @@ -16,12 +16,15 @@
>  void res_counter_init(struct res_counter *counter)
>  {
>  	spin_lock_init(&counter->lock);
> -	counter->limit = (unsigned long)LONG_MAX;

So, we create all containers with infinite limit?

>  }
> 
>  int res_counter_charge_locked(struct res_counter *counter, unsigned long val)
>  {
> -	if (counter->usage + val > counter->limit) {
> +	/*
> +	 * If 'memory.limit' is set to 0, there is no charge to this

nit pick, should be memory.limit_in_bytes

> +	 * res_counter.
> +	 */
> +	if (counter->limit && counter->usage + val > counter->limit) {
>  		counter->failcnt++;
>  		return -ENOMEM;
>  	}


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

  parent reply	other threads:[~2007-09-25 19:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 10:39 [RFC][PATCH] allow "unlimited" limit value KAMEZAWA Hiroyuki
     [not found] ` <20070925193900.1af6d871.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-09-25 10:49   ` Balbir Singh
     [not found]     ` <46F8E7AE.2090309-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-09-25 11:29       ` KAMEZAWA Hiroyuki
     [not found]         ` <20070925202954.4e477564.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-09-25 11:54           ` Balbir Singh
     [not found]             ` <46F8F6FE.7040006-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-09-25 13:06               ` Pavel Emelyanov
     [not found]                 ` <46F907CE.1060807-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-25 13:31                   ` Balbir Singh
     [not found]                     ` <46F90DCA.5030209-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-09-25 13:34                       ` Pavel Emelyanov
     [not found]                         ` <46F90E48.6080603-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-25 15:05                           ` KAMEZAWA Hiroyuki
     [not found]                             ` <20070926000510.7d956db8.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-09-25 15:14                               ` Pavel Emelyanov
     [not found]                                 ` <46F925ED.20303-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-25 15:30                                   ` KAMEZAWA Hiroyuki
     [not found]                                     ` <20070926003056.7df087a0.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-09-25 19:07                                       ` David Rientjes
     [not found]                                         ` <alpine.DEB.0.9999.0709251205390.19001-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2007-09-25 19:21                                           ` Balbir Singh [this message]
     [not found]                                             ` <46F95FD7.3010204-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-09-25 19:30                                               ` David Rientjes
2007-09-25 19:35                                               ` Paul Menage
     [not found]                                                 ` <6599ad830709251235u33dde9c8pfd56ed3d9d4fbe4b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25 19:40                                                   ` David Rientjes
     [not found]                                                     ` <alpine.DEB.0.9999.0709251236040.23337-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2007-09-25 20:00                                                       ` Paul Menage
     [not found]                                                         ` <6599ad830709251300sea126bam5a4b6f7c6bd366e0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25 20:07                                                           ` David Rientjes
     [not found]                                                             ` <alpine.DEB.0.9999.0709251304030.28350-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2007-09-25 20:12                                                               ` Paul Menage
     [not found]                                                                 ` <6599ad830709251312p7cdfae3byac2048fdc64ea5ca-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25 20:32                                                                   ` David Rientjes
     [not found]                                                                     ` <alpine.DEB.0.9999.0709251325540.29575-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2007-09-25 20:40                                                                       ` Paul Menage
     [not found]                                                                         ` <6599ad830709251340t6e002dcbh6d7bcc6e6405739-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25 20:58                                                                           ` David Rientjes
     [not found]                                                                             ` <alpine.DEB.0.9999.0709251346550.30668-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2007-09-26  0:06                                                                               ` Paul Menage
2007-09-26  1:23                                               ` KAMEZAWA Hiroyuki
     [not found]                                                 ` <20070926102343.0f700503.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-09-26  9:45                                                   ` Pavel Emelyanov
     [not found]                                                     ` <46FA2A4B.4040801-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-26 10:59                                                       ` Balbir Singh
     [not found]                                                         ` <46FA3B94.3080808-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-09-26 11:02                                                           ` Pavel Emelyanov

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=46F95FD7.3010204@linux.vnet.ibm.com \
    --to=balbir-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    /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