[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080714171154.e1cc9943.kamezawa.hiroyu@jp.fujitsu.com>
Date: Mon, 14 Jul 2008 17:11:54 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
"xemul@...nvz.org" <xemul@...nvz.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2][-mm][resend] res_counter limit change support ebusy
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:
- fixed white space bug.
Acked-by: Balbir Singh <balbir@...ux.vnet.ibm.com>
Acked-by: Pavel Emelyanov <xemul@...nvz.org>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
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
--
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