aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/res_counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/res_counter.h')
-rw-r--r--include/linux/res_counter.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 8cb1ecd420a9..df8085acba16 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -25,6 +25,10 @@ struct res_counter {
25 */ 25 */
26 unsigned long long usage; 26 unsigned long long usage;
27 /* 27 /*
28 * the maximal value of the usage from the counter creation
29 */
30 unsigned long long max_usage;
31 /*
28 * the limit that usage cannot exceed 32 * the limit that usage cannot exceed
29 */ 33 */
30 unsigned long long limit; 34 unsigned long long limit;
@@ -67,6 +71,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member,
67 71
68enum { 72enum {
69 RES_USAGE, 73 RES_USAGE,
74 RES_MAX_USAGE,
70 RES_LIMIT, 75 RES_LIMIT,
71 RES_FAILCNT, 76 RES_FAILCNT,
72}; 77};
@@ -127,4 +132,13 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
127 return ret; 132 return ret;
128} 133}
129 134
135static inline void res_counter_reset_max(struct res_counter *cnt)
136{
137 unsigned long flags;
138
139 spin_lock_irqsave(&cnt->lock, flags);
140 cnt->max_usage = cnt->usage;
141 spin_unlock_irqrestore(&cnt->lock, flags);
142}
143
130#endif 144#endif