Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143205
b: refs/heads/master
c: 5341cfa
h: refs/heads/master
i:
  143203: 301423c
v: v3
  • Loading branch information
Andrea Righi authored and Linus Torvalds committed Apr 13, 2009
1 parent 9bfefc7 commit 2994e6b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bdff549ebeff92b1a6952e5501caf16a6f8898c8
refs/heads/master: 5341cfab94ec05b8a45726f9fe15e71c0cd9b915
27 changes: 21 additions & 6 deletions trunk/Documentation/cgroups/resource_counter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ to work with it.

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
routine called for a new counter.

b. int res_counter_charge[_locked]
(struct res_counter *rc, unsigned long val)
The struct res_counter *parent can be used to define a hierarchical
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
with the appropriate resource counter (controller should determine
Expand All @@ -67,15 +72,25 @@ to work with it.
* if the charging is performed first, then it should be uncharged
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)

When a resource is released (freed) it should be de-accounted
from the resource counter it was accounted to. This is called
"uncharging".

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

Expand Down

0 comments on commit 2994e6b

Please sign in to comment.