aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-04-07 18:37:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:35:54 -0400
commit539a13b47e462d28c48f076c63871580f694a366 (patch)
treeb0db5d5314b1276d433c3ae826d3a19a8902bec6
parentf0432d159601f96839f514f286eaa5b75c4112dc (diff)
res_counter: remove interface for locked charging and uncharging
The res_counter_{charge,uncharge}_locked() variants are not used in the kernel outside of the resource counter code itself, so remove the interface. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Tejun Heo <tj@kernel.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Jianguo Wu <wujianguo@huawei.com> Cc: Tim Hockin <thockin@google.com> Cc: Christoph Lameter <cl@linux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/cgroups/resource_counter.txt12
-rw-r--r--include/linux/res_counter.h6
-rw-r--r--kernel/res_counter.c23
3 files changed, 15 insertions, 26 deletions
diff --git a/Documentation/cgroups/resource_counter.txt b/Documentation/cgroups/resource_counter.txt
index 5108afb3645c..762ca54eb929 100644
--- a/Documentation/cgroups/resource_counter.txt
+++ b/Documentation/cgroups/resource_counter.txt
@@ -76,15 +76,7 @@ to work with it.
76 limit_fail_at parameter is set to the particular res_counter element 76 limit_fail_at parameter is set to the particular res_counter element
77 where the charging failed. 77 where the charging failed.
78 78
79 d. int res_counter_charge_locked 79 d. u64 res_counter_uncharge(struct res_counter *rc, unsigned long val)
80 (struct res_counter *rc, unsigned long val, bool force)
81
82 The same as res_counter_charge(), but it must not acquire/release the
83 res_counter->lock internally (it must be called with res_counter->lock
84 held). The force parameter indicates whether we can bypass the limit.
85
86 e. u64 res_counter_uncharge[_locked]
87 (struct res_counter *rc, unsigned long val)
88 80
89 When a resource is released (freed) it should be de-accounted 81 When a resource is released (freed) it should be de-accounted
90 from the resource counter it was accounted to. This is called 82 from the resource counter it was accounted to. This is called
@@ -93,7 +85,7 @@ to work with it.
93 85
94 The _locked routines imply that the res_counter->lock is taken. 86 The _locked routines imply that the res_counter->lock is taken.
95 87
96 f. u64 res_counter_uncharge_until 88 e. u64 res_counter_uncharge_until
97 (struct res_counter *rc, struct res_counter *top, 89 (struct res_counter *rc, struct res_counter *top,
98 unsigned long val) 90 unsigned long val)
99 91
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 201a69749659..56b7bc32db4f 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -104,15 +104,13 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
104 * units, e.g. numbers, bytes, Kbytes, etc 104 * units, e.g. numbers, bytes, Kbytes, etc
105 * 105 *
106 * returns 0 on success and <0 if the counter->usage will exceed the 106 * returns 0 on success and <0 if the counter->usage will exceed the
107 * counter->limit _locked call expects the counter->lock to be taken 107 * counter->limit
108 * 108 *
109 * charge_nofail works the same, except that it charges the resource 109 * charge_nofail works the same, except that it charges the resource
110 * counter unconditionally, and returns < 0 if the after the current 110 * counter unconditionally, and returns < 0 if the after the current
111 * charge we are over limit. 111 * charge we are over limit.
112 */ 112 */
113 113
114int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val, bool force);
116int __must_check res_counter_charge(struct res_counter *counter, 114int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 115 unsigned long val, struct res_counter **limit_fail_at);
118int res_counter_charge_nofail(struct res_counter *counter, 116int res_counter_charge_nofail(struct res_counter *counter,
@@ -125,12 +123,10 @@ int res_counter_charge_nofail(struct res_counter *counter,
125 * @val: the amount of the resource 123 * @val: the amount of the resource
126 * 124 *
127 * these calls check for usage underflow and show a warning on the console 125 * these calls check for usage underflow and show a warning on the console
128 * _locked call expects the counter->lock to be taken
129 * 126 *
130 * returns the total charges still present in @counter. 127 * returns the total charges still present in @counter.
131 */ 128 */
132 129
133u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
134u64 res_counter_uncharge(struct res_counter *counter, unsigned long val); 130u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
135 131
136u64 res_counter_uncharge_until(struct res_counter *counter, 132u64 res_counter_uncharge_until(struct res_counter *counter,
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 4aa8a305aede..51dbac6a3633 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -22,8 +22,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent)
22 counter->parent = parent; 22 counter->parent = parent;
23} 23}
24 24
25int res_counter_charge_locked(struct res_counter *counter, unsigned long val, 25static u64 res_counter_uncharge_locked(struct res_counter *counter,
26 bool force) 26 unsigned long val)
27{
28 if (WARN_ON(counter->usage < val))
29 val = counter->usage;
30
31 counter->usage -= val;
32 return counter->usage;
33}
34
35static int res_counter_charge_locked(struct res_counter *counter,
36 unsigned long val, bool force)
27{ 37{
28 int ret = 0; 38 int ret = 0;
29 39
@@ -86,15 +96,6 @@ int res_counter_charge_nofail(struct res_counter *counter, unsigned long val,
86 return __res_counter_charge(counter, val, limit_fail_at, true); 96 return __res_counter_charge(counter, val, limit_fail_at, true);
87} 97}
88 98
89u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val)
90{
91 if (WARN_ON(counter->usage < val))
92 val = counter->usage;
93
94 counter->usage -= val;
95 return counter->usage;
96}
97
98u64 res_counter_uncharge_until(struct res_counter *counter, 99u64 res_counter_uncharge_until(struct res_counter *counter,
99 struct res_counter *top, 100 struct res_counter *top,
100 unsigned long val) 101 unsigned long val)