lkml.org 
[lkml]   [2008]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] res_counter : check limit change
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 in it.
>
> Changelog:
> - fixed white space bug.
>
> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>

Acked-by: Pavel Emelyanov <xemul@openvz.org>

> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
>
> include/linux/res_counter.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> Index: test-2.6.26-rc8-mm1/include/linux/res_counter.h
> ===================================================================
> --- test-2.6.26-rc8-mm1.orig/include/linux/res_counter.h
> +++ test-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
>
>



\
 
 \ /
  Last update: 2008-07-04 12:55    [W:0.278 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site