res_counter: remove interface for locked charging and uncharging
authorDavid Rientjes <rientjes@google.com>
Mon, 7 Apr 2014 22:37:32 +0000 (15:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 7 Apr 2014 23:35:54 +0000 (16:35 -0700)
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>
Documentation/cgroups/resource_counter.txt
include/linux/res_counter.h
kernel/res_counter.c

index 5108afb3645c49d948cd97e7c827b2d5599e499e..762ca54eb92989ab0129d227b3b0296cb99d832a 100644 (file)
@@ -76,15 +76,7 @@ to work with it.
        limit_fail_at parameter is set to the particular res_counter element
        where the charging failed.
 
- d. int res_counter_charge_locked
-                       (struct res_counter *rc, unsigned long val, bool force)
-
-       The same as res_counter_charge(), but it must not acquire/release the
-       res_counter->lock internally (it must be called with res_counter->lock
-       held). The force parameter indicates whether we can bypass the limit.
-
- e. u64 res_counter_uncharge[_locked]
-                       (struct res_counter *rc, unsigned long val)
+ d. u64 res_counter_uncharge(struct res_counter *rc, unsigned long val)
 
        When a resource is released (freed) it should be de-accounted
        from the resource counter it was accounted to.  This is called
@@ -93,7 +85,7 @@ to work with it.
 
        The _locked routines imply that the res_counter->lock is taken.
 
f. u64 res_counter_uncharge_until
e. u64 res_counter_uncharge_until
                (struct res_counter *rc, struct res_counter *top,
                 unsigned long val)
 
index 201a6974965925bf5f9424acf0b63f671efd3c60..56b7bc32db4f89aa924e5c02ae929af3a32fe83d 100644 (file)
@@ -104,15 +104,13 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
  *       units, e.g. numbers, bytes, Kbytes, etc
  *
  * returns 0 on success and <0 if the counter->usage will exceed the
- * counter->limit _locked call expects the counter->lock to be taken
+ * counter->limit
  *
  * charge_nofail works the same, except that it charges the resource
  * counter unconditionally, and returns < 0 if the after the current
  * charge we are over limit.
  */
 
-int __must_check res_counter_charge_locked(struct res_counter *counter,
-                                          unsigned long val, bool force);
 int __must_check res_counter_charge(struct res_counter *counter,
                unsigned long val, struct res_counter **limit_fail_at);
 int res_counter_charge_nofail(struct res_counter *counter,
@@ -125,12 +123,10 @@ int res_counter_charge_nofail(struct res_counter *counter,
  * @val: the amount of the resource
  *
  * these calls check for usage underflow and show a warning on the console
- * _locked call expects the counter->lock to be taken
  *
  * returns the total charges still present in @counter.
  */
 
-u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
 u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
 
 u64 res_counter_uncharge_until(struct res_counter *counter,
index 4aa8a305aedeb23cf7ad15aa2750898057b3c0d4..51dbac6a363358b435a14f9e7952b9489eb3bf9d 100644 (file)
@@ -22,8 +22,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent)
        counter->parent = parent;
 }
 
-int res_counter_charge_locked(struct res_counter *counter, unsigned long val,
-                             bool force)
+static u64 res_counter_uncharge_locked(struct res_counter *counter,
+                                      unsigned long val)
+{
+       if (WARN_ON(counter->usage < val))
+               val = counter->usage;
+
+       counter->usage -= val;
+       return counter->usage;
+}
+
+static int res_counter_charge_locked(struct res_counter *counter,
+                                    unsigned long val, bool force)
 {
        int ret = 0;
 
@@ -86,15 +96,6 @@ int res_counter_charge_nofail(struct res_counter *counter, unsigned long val,
        return __res_counter_charge(counter, val, limit_fail_at, true);
 }
 
-u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val)
-{
-       if (WARN_ON(counter->usage < val))
-               val = counter->usage;
-
-       counter->usage -= val;
-       return counter->usage;
-}
-
 u64 res_counter_uncharge_until(struct res_counter *counter,
                               struct res_counter *top,
                               unsigned long val)