All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: KAMEZAWA Hiroyuki
	<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: "yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org"
	<yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>,
	"nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org"
	<nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>,
	"kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org"
	<kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org>,
	"containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org"
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	"menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org"
	<menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org"
	<balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [RFC][PATCH 1/4] res_counter set_limit and -EBUSY.
Date: Mon, 21 Jul 2008 21:32:10 +0400	[thread overview]
Message-ID: <4884C81A.8090006@openvz.org> (raw)
In-Reply-To: <20080718193437.ae79478a.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

KAMEZAWA Hiroyuki wrote:
> Add an interface to set limit. This is necessary to memory resource controller
> because it shrinks usage at set limit.
> 
> (*) Other controller may not need this interface to shrink usage because
>     shrinking is not necessary or impossible.
> 
> This is an enhancement.
> named as res_counter-limit-change-ebusy.patch
> 
> Changelog v1->v2
>   - fixed white space bug.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

Acked-by: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>

> 
>  include/linux/res_counter.h |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> Index: linux-2.6.26-rc8-mm1/include/linux/res_counter.h
> ===================================================================
> --- linux-2.6.26-rc8-mm1.orig/include/linux/res_counter.h
> +++ linux-2.6.26-rc8-mm1/include/linux/res_counter.h
> @@ -176,4 +176,19 @@ static inline bool res_counter_can_add(s
>  	return ret;
>  }
>  
> +static inline int res_counter_set_limit(struct res_counter *cnt,
> +	unsigned long long limit)
> +{
> +	unsigned long flags;
> +	int ret = -EBUSY;
> +
> +	spin_lock_irqsave(&cnt->lock, flags);
> +	if (cnt->usage < limit) {
> +		cnt->limit = limit;
> +		ret = 0;
> +	}
> +	spin_unlock_irqrestore(&cnt->lock, flags);
> +	return ret;
> +}
> +
>  #endif
> 
> 

  parent reply	other threads:[~2008-07-21 17:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18 10:31 [RFC][PATCH 0/4[ memcg shrinking usage KAMEZAWA Hiroyuki
     [not found] ` <20080718193123.cf74b574.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-07-18 10:34   ` [RFC][PATCH 1/4] res_counter set_limit and -EBUSY KAMEZAWA Hiroyuki
     [not found]     ` <20080718193437.ae79478a.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-07-21 17:32       ` Pavel Emelyanov [this message]
2008-07-18 10:35   ` [RFC][PATCH 2/4] res_counter check usage under val KAMEZAWA Hiroyuki
     [not found]     ` <20080718193530.578fb1e3.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-07-21 17:41       ` Pavel Emelyanov
     [not found]     ` <4884CA4F.9060003-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-07-28  8:28       ` kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A
     [not found]         ` <26133366.1217233738316.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-07-30  2:09           ` Pavel Emelyanov
     [not found]             ` <488FCD42.4090309-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-07-30 11:41               ` Paul Menage
     [not found]                 ` <6599ad830807300441w5b1c149dg7dc0f4eb521439e7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-30 12:34                   ` Pavel Emelyanov
2008-07-18 10:36   ` [RFC][PATCH 3/4] memcg shrink usage at limit change KAMEZAWA Hiroyuki
2008-07-18 10:37   ` [RFC][PATCH 4/4] memcg shrinking usage 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=4884C81A.8090006@openvz.org \
    --to=xemul-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org \
    --cc=yamamoto-jCdQPDEk3idL9jVzuh4AOg@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 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.