diff options
Diffstat (limited to 'Documentation/cgroups/memory.txt')
-rw-r--r-- | Documentation/cgroups/memory.txt | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 9b1067afb224..dd88540bb995 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -184,12 +184,14 @@ behind this approach is that a cgroup that aggressively uses a shared | |||
184 | page will eventually get charged for it (once it is uncharged from | 184 | page will eventually get charged for it (once it is uncharged from |
185 | the cgroup that brought it in -- this will happen on memory pressure). | 185 | the cgroup that brought it in -- this will happen on memory pressure). |
186 | 186 | ||
187 | But see section 8.2: when moving a task to another cgroup, its pages may | ||
188 | be recharged to the new cgroup, if move_charge_at_immigrate has been chosen. | ||
189 | |||
187 | Exception: If CONFIG_CGROUP_CGROUP_MEM_RES_CTLR_SWAP is not used. | 190 | Exception: If CONFIG_CGROUP_CGROUP_MEM_RES_CTLR_SWAP is not used. |
188 | When you do swapoff and make swapped-out pages of shmem(tmpfs) to | 191 | When you do swapoff and make swapped-out pages of shmem(tmpfs) to |
189 | be backed into memory in force, charges for pages are accounted against the | 192 | be backed into memory in force, charges for pages are accounted against the |
190 | caller of swapoff rather than the users of shmem. | 193 | caller of swapoff rather than the users of shmem. |
191 | 194 | ||
192 | |||
193 | 2.4 Swap Extension (CONFIG_CGROUP_MEM_RES_CTLR_SWAP) | 195 | 2.4 Swap Extension (CONFIG_CGROUP_MEM_RES_CTLR_SWAP) |
194 | 196 | ||
195 | Swap Extension allows you to record charge for swap. A swapped-in page is | 197 | Swap Extension allows you to record charge for swap. A swapped-in page is |
@@ -374,14 +376,15 @@ cgroup might have some charge associated with it, even though all | |||
374 | tasks have migrated away from it. (because we charge against pages, not | 376 | tasks have migrated away from it. (because we charge against pages, not |
375 | against tasks.) | 377 | against tasks.) |
376 | 378 | ||
377 | Such charges are freed or moved to their parent. At moving, both of RSS | 379 | We move the stats to root (if use_hierarchy==0) or parent (if |
378 | and CACHES are moved to parent. | 380 | use_hierarchy==1), and no change on the charge except uncharging |
379 | rmdir() may return -EBUSY if freeing/moving fails. See 5.1 also. | 381 | from the child. |
380 | 382 | ||
381 | Charges recorded in swap information is not updated at removal of cgroup. | 383 | Charges recorded in swap information is not updated at removal of cgroup. |
382 | Recorded information is discarded and a cgroup which uses swap (swapcache) | 384 | Recorded information is discarded and a cgroup which uses swap (swapcache) |
383 | will be charged as a new owner of it. | 385 | will be charged as a new owner of it. |
384 | 386 | ||
387 | About use_hierarchy, see Section 6. | ||
385 | 388 | ||
386 | 5. Misc. interfaces. | 389 | 5. Misc. interfaces. |
387 | 390 | ||
@@ -394,13 +397,15 @@ will be charged as a new owner of it. | |||
394 | 397 | ||
395 | Almost all pages tracked by this memory cgroup will be unmapped and freed. | 398 | Almost all pages tracked by this memory cgroup will be unmapped and freed. |
396 | Some pages cannot be freed because they are locked or in-use. Such pages are | 399 | Some pages cannot be freed because they are locked or in-use. Such pages are |
397 | moved to parent and this cgroup will be empty. This may return -EBUSY if | 400 | moved to parent(if use_hierarchy==1) or root (if use_hierarchy==0) and this |
398 | VM is too busy to free/move all pages immediately. | 401 | cgroup will be empty. |
399 | 402 | ||
400 | Typical use case of this interface is that calling this before rmdir(). | 403 | Typical use case of this interface is that calling this before rmdir(). |
401 | Because rmdir() moves all pages to parent, some out-of-use page caches can be | 404 | Because rmdir() moves all pages to parent, some out-of-use page caches can be |
402 | moved to the parent. If you want to avoid that, force_empty will be useful. | 405 | moved to the parent. If you want to avoid that, force_empty will be useful. |
403 | 406 | ||
407 | About use_hierarchy, see Section 6. | ||
408 | |||
404 | 5.2 stat file | 409 | 5.2 stat file |
405 | 410 | ||
406 | memory.stat file includes following statistics | 411 | memory.stat file includes following statistics |
@@ -430,17 +435,10 @@ hierarchical_memory_limit - # of bytes of memory limit with regard to hierarchy | |||
430 | hierarchical_memsw_limit - # of bytes of memory+swap limit with regard to | 435 | hierarchical_memsw_limit - # of bytes of memory+swap limit with regard to |
431 | hierarchy under which memory cgroup is. | 436 | hierarchy under which memory cgroup is. |
432 | 437 | ||
433 | total_cache - sum of all children's "cache" | 438 | total_<counter> - # hierarchical version of <counter>, which in |
434 | total_rss - sum of all children's "rss" | 439 | addition to the cgroup's own value includes the |
435 | total_mapped_file - sum of all children's "cache" | 440 | sum of all hierarchical children's values of |
436 | total_pgpgin - sum of all children's "pgpgin" | 441 | <counter>, i.e. total_cache |
437 | total_pgpgout - sum of all children's "pgpgout" | ||
438 | total_swap - sum of all children's "swap" | ||
439 | total_inactive_anon - sum of all children's "inactive_anon" | ||
440 | total_active_anon - sum of all children's "active_anon" | ||
441 | total_inactive_file - sum of all children's "inactive_file" | ||
442 | total_active_file - sum of all children's "active_file" | ||
443 | total_unevictable - sum of all children's "unevictable" | ||
444 | 442 | ||
445 | # The following additional stats are dependent on CONFIG_DEBUG_VM. | 443 | # The following additional stats are dependent on CONFIG_DEBUG_VM. |
446 | 444 | ||
@@ -622,8 +620,7 @@ memory cgroup. | |||
622 | bit | what type of charges would be moved ? | 620 | bit | what type of charges would be moved ? |
623 | -----+------------------------------------------------------------------------ | 621 | -----+------------------------------------------------------------------------ |
624 | 0 | A charge of an anonymous page(or swap of it) used by the target task. | 622 | 0 | A charge of an anonymous page(or swap of it) used by the target task. |
625 | | Those pages and swaps must be used only by the target task. You must | 623 | | You must enable Swap Extension(see 2.4) to enable move of swap charges. |
626 | | enable Swap Extension(see 2.4) to enable move of swap charges. | ||
627 | -----+------------------------------------------------------------------------ | 624 | -----+------------------------------------------------------------------------ |
628 | 1 | A charge of file pages(normal file, tmpfs file(e.g. ipc shared memory) | 625 | 1 | A charge of file pages(normal file, tmpfs file(e.g. ipc shared memory) |
629 | | and swaps of tmpfs file) mmapped by the target task. Unlike the case of | 626 | | and swaps of tmpfs file) mmapped by the target task. Unlike the case of |
@@ -636,8 +633,6 @@ memory cgroup. | |||
636 | 633 | ||
637 | 8.3 TODO | 634 | 8.3 TODO |
638 | 635 | ||
639 | - Implement madvise(2) to let users decide the vma to be moved or not to be | ||
640 | moved. | ||
641 | - All of moving charge operations are done under cgroup_mutex. It's not good | 636 | - All of moving charge operations are done under cgroup_mutex. It's not good |
642 | behavior to hold the mutex too long, so we may need some trick. | 637 | behavior to hold the mutex too long, so we may need some trick. |
643 | 638 | ||