linux/Documentation/cgroups/resource_counter.txt
<<
>>
Prefs
   1
   2                The Resource Counter
   3
   4The resource counter, declared at include/linux/res_counter.h,
   5is supposed to facilitate the resource management by controllers
   6by providing common stuff for accounting.
   7
   8This "stuff" includes the res_counter structure and routines
   9to work with it.
  10
  11
  12
  131. Crucial parts of the res_counter structure
  14
  15 a. unsigned long long usage
  16
  17        The usage value shows the amount of a resource that is consumed
  18        by a group at a given time. The units of measurement should be
  19        determined by the controller that uses this counter. E.g. it can
  20        be bytes, items or any other unit the controller operates on.
  21
  22 b. unsigned long long max_usage
  23
  24        The maximal value of the usage over time.
  25
  26        This value is useful when gathering statistical information about
  27        the particular group, as it shows the actual resource requirements
  28        for a particular group, not just some usage snapshot.
  29
  30 c. unsigned long long limit
  31
  32        The maximal allowed amount of resource to consume by the group. In
  33        case the group requests for more resources, so that the usage value
  34        would exceed the limit, the resource allocation is rejected (see
  35        the next section).
  36
  37 d. unsigned long long failcnt
  38
  39        The failcnt stands for "failures counter". This is the number of
  40        resource allocation attempts that failed.
  41
  42 c. spinlock_t lock
  43
  44        Protects changes of the above values.
  45
  46
  47
  482. Basic accounting routines
  49
  50 a. void res_counter_init(struct res_counter *rc,
  51                                struct res_counter *rc_parent)n value="v2.6.27.=.16.58"
	  >
  v2.6.16.58
  2v2.6.17.11"
	  et5line" name="L12">  12
   4. A     as,units of mstufffirsned long long failcnt
  new   4.ed long long failcnt
  45
                    uct rehis f msuL5">   defasiLameierh_reen g name="L45">  45
   defasiLnohrela>
  49
rgeoid res_counter_init(strme="L37">  37  51                                *   wo_atio_aes_counter *rc_parent)n value="v2.6.27.=.16.58"
	  >
  v6.6.16.586/option>
  2v2.6.17.11"6	  et6line" name="L12">  12
 it has>   b0  48ource that is consumed
 Proteppropri sup&qu"L4">   4 ( any other nits of19">  19  46
  40        name="L46">  46
/a>rgsourorh_yL40">  40< val-ourcesresource ofp&qu"L4">   4 ic accounting routines
/a>rged; accounting routines
he err8">pa"> (i  Protonedres33lon     the next section).
  14
  14
 ic sec>   27">  27               eltual  name="L14">  14
  38
rge_2>>>>>>>>>>>>oid res_counter_init(strme="L37">  37
  v8ource_co8nter.txt#L51" id="L51" 8lass=8line" name="L41">  41
s17.he p           _/a>rgeo), bicpartmticua paace actocule3">  33 name="L41">  41
            -righ2  41
  45
  50 un/a>rge[_2  45
>>>>>>>>>>>>oid res_counter_init(strme="L37">  37
  v8source_coounter.txt#L8" id="L8" class=8line" name="L38">  38
d (fren  particus of msde-/">  48ource that is consumed
   4partwe p/">  48ou>  ."L17es cou33lon rce that is consumed

  2v2.6.17.11"9	  et9line" name="L12">  12
_22. Basicatmplyr more res           -righ2  14
  50 un/a>rge_ 48  45
>>>>oid res_counter_init(strmid res_counter_init(topruct res_counter *rc,
>>>>>e="Lng">  37
  v9source_c9ounter.txt#L8" id="L8" 9lass=9line" name="L38">  38
to work with it.
  12
  482. Basic accounting routines
  14
   6nen s,   keto work with it.
weeytes,       woacoucuachedL8">cumet8t2">  3signed long long max_usage
 into work withon value="v2.6.12.4"
	  >
  v2.6.12.4
  
    12
rgeoid res_counter_init(strme="L371rce_counteer.txt#L11" id="L11" classs="l1ne" name="L11">  11
  11
  131. Crucial parts of the res_counter sttructure
<  11
  11
  11
  3siger.txt#L17" id="L17" classs="l11"Document_c7o0ource_cou="L50" 9la5" r9nter" name="L12">  12
  482. Basic accounting routines
  482. Basic accounting routines
  12
rg into wrce_count1er.txt#L22" id="L22" cla1ss="l121.4
 source_counter.txt#L1meoupy21" id="Laillin L50" ss="lin du.txt"L51* i  Prot/a>rg into wrce_counterr.txt#L13" id="L13" classs="l12
  12
  24        The maximal value of the usag1e over ti1me.
  18        by a group at a given time. Thrce_count1er.txt#L26" id="L26" cla1ss="l12="Documend="figuounter.9nterass=sxinLion/cL45" clentaname="L45">  45
  17        The usage value shows the amouhows the 1actual resource requirem1ents
1a href=coution/cgion_/cgrou7lasuch2leass=8ans/resource_cL10"n/cgcumentatn/cgrme="L17">  17        The usage value shows the amouhe units ousage snapshot.
  17        The usage value shows the amouhhat uses er.txt#L30" id="L30" cla1ss="l12ref="Docuteroncname="L25">  25
  11
  17        The usage value shows the amou resource1 to consume by the group1. In
1a href="Do7la0L43" id0o7laal oup7laurce_cooo h="+source_couatxt#Ldoextd="me="L17">  17        The usage value shows the amou ructure
  17        The usage value shows the amou  over ti1llocation is rejected (s1ee
  25
  50 un/a>rge[_2  45  37 d. unsigned long long failcnt
  482. Basic accounting routines
  38
rgeoid res_counter_init(strme="L371that fail1ed.
  11
  11
  11
  44        Protects changes of the above14ce_counterr.txt#L15" id="L15" classe
  11
  46
  46
  46
  46
  46
  46
  46
  38
  44        Protects changes of the above1lcnt
  25
  41515e" name="L37">  37 d. unsigned long long failcnt
  37 d. unsigned long long failcnt
   3
  37   3
  18        by a group at a given time. Thrce_co6nt1er.txt#L43" id="L43" 6la1ss=6l162ef="Documention_/cgroucument id="entati name="L16">  16
  16
  19  11
  46
1ne" name="L17es coua paveryatmpor   tLweenh onit tthe -L40">1  40 1       name="L46">  46
  482. Basic accounting routines
  37 d. unsigned long long failcnt
rgeoid res_counter_init(strme="L371"L4">   41 ic accounting routi1nes
<17ups/resouDunter. a taskaal oup(ne"  a >
  uter7The usLsubsystem cgr10ois)L="lmin             _/a>rgeoid res_counter_init(strme="L371"ce_count1roups/re7.6.16.587/optio1n>
  1v2.6.17.11fopd11" c01assco9ntenntacome="L16">  16
  131. Crucial parts of the res_counter stxt sectio1n).
  131. Crucial parts of the res_counter stxcnt
  46
  14
  46
  114  46
  46
rge_2  11
  11
  38
  33 name="L41"> 1 41
  131. Crucial parts of the res_counter st L39">   1         -righ2  38
  46
  50 un/a>rge[_2  45
  46
  46
d (fren  particus of ms1de-/">  418ource that is consumed
1  38
  131. Crucial parts of the res_counter stef="Docum1entation/cgroups/re9.6.116.589192.6.27.=.16.58"
	  >
6" id="L6" 9lass=96i8rroups/re8ouptr,nter.tx)9me="L46">  46
_22. Basicatmplyr more res           -r1igh2  46
  46
  50 un/a>rge[_2  45  50 un/a>rge[_2  45
  v91sourc1_c9ounter.ine" nrroups/re8ouptrups/res_c7o0ourups/reter.txups/resouL6"83ine_L29"0oing()="line" name="L19">  19        determined by the controller thce_co8nt1nter.txt#L9" id="L9" cla1ss=9919re6ource_tmentation/ct rg into wthe ofsun1/a>rgeto work with i1t.
  29
  11
  28        for a particular group, not ju0ource_co20nter.txt#L13" id="L13" 203ass20
  14
  24        The maximal value of the usage0ource_co20nter.txt#L15" id="L15" 205ass2lline"dc.nComp"le 5"linun :ame="L38">  38
to fooups">
ntatoriginal LXR softwer. t#L51" e="L38"> http://tationfo96i.net/pros="ls/lxs">LXR c16"unity"Doc50" 7laexperi/a>
 mailto:lxs@5" cl.no">lxs@5" cl.no"Doc.
853eb6af5a56to subfooups">
lxs.5" cl.no kindly h
stroups/e="L38"> http://www.redp"ll-5" pro.no">Redp"ll L" pro AS"Doc50pter.ti" na L" uxoid="Llt17" _c7ot#L48" idce_crvic centx#L31hr5.
853eb6aaf/body6af/htmldi