res_counter: update documentation

After the introduction of resource counters hierarchies
(28dbc4b6a0) the prototypes of
res_counter_init() and res_counter_charge() have been changed.

Keep the documentation consistent with the actual function prototypes.

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: Paul Menage <menage@google.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Andrea Righi 2009-04-13 14:39:58 -07:00 committed by Linus Torvalds
parent bdff549ebe
commit 5341cfab94

View file

@ -47,13 +47,18 @@ to work with it.
2. Basic accounting routines 2. Basic accounting routines
a. void res_counter_init(struct res_counter *rc) a. void res_counter_init(struct res_counter *rc,
struct res_counter *rc_parent)
Initializes the resource counter. As usual, should be the first Initializes the resource counter. As usual, should be the first
routine called for a new counter. routine called for a new counter.
b. int res_counter_charge[_locked] The struct res_counter *parent can be used to define a hierarchical
(struct res_counter *rc, unsigned long val) child -> parent relationship directly in the res_counter structure,
NULL can be used to define no relationship.
c. int res_counter_charge(struct res_counter *rc, unsigned long val,
struct res_counter **limit_fail_at)
When a resource is about to be allocated it has to be accounted When a resource is about to be allocated it has to be accounted
with the appropriate resource counter (controller should determine with the appropriate resource counter (controller should determine
@ -67,7 +72,18 @@ to work with it.
* if the charging is performed first, then it should be uncharged * if the charging is performed first, then it should be uncharged
on error path (if the one is called). on error path (if the one is called).
c. void res_counter_uncharge[_locked] If the charging fails and a hierarchical dependency exists, the
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)
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).
e. void res_counter_uncharge[_locked]
(struct res_counter *rc, unsigned long val) (struct res_counter *rc, unsigned long val)
When a resource is released (freed) it should be de-accounted When a resource is released (freed) it should be de-accounted
@ -76,7 +92,6 @@ to work with it.
The _locked routines imply that the res_counter->lock is taken. The _locked routines imply that the res_counter->lock is taken.
2.1 Other accounting routines 2.1 Other accounting routines
There are more routines that may help you with common needs, like There are more routines that may help you with common needs, like