linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2][-mm][resend] res_counter limit change support ebusy
@ 2008-07-14  8:11 KAMEZAWA Hiroyuki
  2008-07-14  8:15 ` [PATCH 2/2][-mm][resend] memcg limit change shrink usage KAMEZAWA Hiroyuki
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-07-14  8:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, balbir, xemul, LKML

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@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: 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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-28  8:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-14  8:11 [PATCH 1/2][-mm][resend] res_counter limit change support ebusy KAMEZAWA Hiroyuki
2008-07-14  8:15 ` [PATCH 2/2][-mm][resend] memcg limit change shrink usage KAMEZAWA Hiroyuki
2008-07-22  8:45   ` Andrew Morton
2008-07-28  8:43   ` kamezawa.hiroyu
2008-07-28  8:53     ` Andrew Morton
2008-07-22  8:40 ` [PATCH 1/2][-mm][resend] res_counter limit change support ebusy Andrew Morton
2008-07-28  8:39 ` kamezawa.hiroyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox