Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

res_counter: update documentation

After the introduction of resource counters hierarchies
(28dbc4b6a01fb579a9441c7b81e3d3413dc452df) 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>

authored by

Andrea Righi and committed by
Linus Torvalds
5341cfab bdff549e

+21 -6
+21 -6
Documentation/cgroups/resource_counter.txt
··· 47 47 48 48 2. Basic accounting routines 49 49 50 - a. void res_counter_init(struct res_counter *rc) 50 + a. void res_counter_init(struct res_counter *rc, 51 + struct res_counter *rc_parent) 51 52 52 53 Initializes the resource counter. As usual, should be the first 53 54 routine called for a new counter. 54 55 55 - b. int res_counter_charge[_locked] 56 - (struct res_counter *rc, unsigned long val) 56 + The struct res_counter *parent can be used to define a hierarchical 57 + child -> parent relationship directly in the res_counter structure, 58 + NULL can be used to define no relationship. 59 + 60 + c. int res_counter_charge(struct res_counter *rc, unsigned long val, 61 + struct res_counter **limit_fail_at) 57 62 58 63 When a resource is about to be allocated it has to be accounted 59 64 with the appropriate resource counter (controller should determine ··· 72 67 * if the charging is performed first, then it should be uncharged 73 68 on error path (if the one is called). 74 69 75 - c. void res_counter_uncharge[_locked] 70 + If the charging fails and a hierarchical dependency exists, the 71 + limit_fail_at parameter is set to the particular res_counter element 72 + where the charging failed. 73 + 74 + d. int res_counter_charge_locked 75 + (struct res_counter *rc, unsigned long val) 76 + 77 + The same as res_counter_charge(), but it must not acquire/release the 78 + res_counter->lock internally (it must be called with res_counter->lock 79 + held). 80 + 81 + e. void res_counter_uncharge[_locked] 76 82 (struct res_counter *rc, unsigned long val) 77 83 78 84 When a resource is released (freed) it should be de-accounted 79 85 from the resource counter it was accounted to. This is called 80 86 "uncharging". 81 87 82 - The _locked routines imply that the res_counter->lock is taken. 83 - 88 + The _locked routines imply that the res_counter->lock is taken. 84 89 85 90 2.1 Other accounting routines 86 91