Linux Container Development
 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 2/4] res_counter check usage under val
Date: Mon, 21 Jul 2008 21:41:35 +0400	[thread overview]
Message-ID: <4884CA4F.9060003@openvz.org> (raw)
In-Reply-To: <20080718193530.578fb1e3.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

KAMEZAWA Hiroyuki wrote:
> Add an interface to check usage is below "val"
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> 
>  include/linux/res_counter.h |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> Index: mmtom-stamp-2008-07-15-15-39/include/linux/res_counter.h
> ===================================================================
> --- mmtom-stamp-2008-07-15-15-39.orig/include/linux/res_counter.h
> +++ mmtom-stamp-2008-07-15-15-39/include/linux/res_counter.h
> @@ -191,4 +191,17 @@ static inline int res_counter_set_limit(
>  	return ret;
>  }
>  
> +static inline int res_counter_check_under_val(struct res_counter *cnt,
> +	unsigned long long val)
> +{
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	spin_lock_irqsave(&cnt->flags, flags);

Is this spilock protection *really* required? As far as I see
from its usage it is racy itself wrt to res_counter update, so 
this locking looks superfluous.

> +	if (cnt->usage < val)
> +		ret = 1;
> +	spin_unlock_irqrestore(&cnt->flags, flags);
> +	return ret;
> +}
> +
>  #endif
> 
> 

  parent reply	other threads:[~2008-07-21 17:41 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
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 [this message]
     [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=4884CA4F.9060003@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox