projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cede86a
)
res_counter: limit change support ebusy
author
KAMEZAWA Hiroyuki
<
[email protected]
>
Fri, 25 Jul 2008 08:47:19 +0000
(
01:47
-0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 25 Jul 2008 17:53:37 +0000
(10:53 -0700)
Add an interface to set limit. This is necessary to memory resource
controller because it shrinks usage at set limit.
Other controllers may not need this interface to shrink usage because
shrinking is not necessary or impossible.
Acked-by: Balbir Singh <
[email protected]
>
Acked-by: Pavel Emelyanov <
[email protected]
>
Signed-off-by: KAMEZAWA Hiroyuki <
[email protected]
>
Cc: Paul Menage <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
include/linux/res_counter.h
patch
|
blob
|
history
diff --git
a/include/linux/res_counter.h
b/include/linux/res_counter.h
index 290205dfe094325a98c77581dea27b3e4a6c69c6..fdeadd9740dc5f99deaa4a8662494914f438e8c4 100644
(file)
--- a/
include/linux/res_counter.h
+++ b/
include/linux/res_counter.h
@@
-158,4
+158,20
@@
static inline void res_counter_reset_failcnt(struct res_counter *cnt)
cnt->failcnt = 0;
spin_unlock_irqrestore(&cnt->lock, flags);
}
+
+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