aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cgroups/memory.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/cgroups/memory.txt')
-rw-r--r--Documentation/cgroups/memory.txt37
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
184page will eventually get charged for it (once it is uncharged from 184page will eventually get charged for it (once it is uncharged from
185the cgroup that brought it in -- this will happen on memory pressure). 185the cgroup that brought it in -- this will happen on memory pressure).
186 186
187But see section 8.2: when moving a task to another cgroup, its pages may
188be recharged to the new cgroup, if move_charge_at_immigrate has been chosen.
189
187Exception: If CONFIG_CGROUP_CGROUP_MEM_RES_CTLR_SWAP is not used. 190Exception: If CONFIG_CGROUP_CGROUP_MEM_RES_CTLR_SWAP is not used.
188When you do swapoff and make swapped-out pages of shmem(tmpfs) to 191When you do swapoff and make swapped-out pages of shmem(tmpfs) to
189be backed into memory in force, charges for pages are accounted against the 192be backed into memory in force, charges for pages are accounted against the
190caller of swapoff rather than the users of shmem. 193caller of swapoff rather than the users of shmem.
191 194
192
1932.4 Swap Extension (CONFIG_CGROUP_MEM_RES_CTLR_SWAP) 1952.4 Swap Extension (CONFIG_CGROUP_MEM_RES_CTLR_SWAP)
194 196
195Swap Extension allows you to record charge for swap. A swapped-in page is 197Swap 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
374tasks have migrated away from it. (because we charge against pages, not 376tasks have migrated away from it. (because we charge against pages, not
375against tasks.) 377against tasks.)
376 378
377Such charges are freed or moved to their parent. At moving, both of RSS 379We move the stats to root (if use_hierarchy==0) or parent (if
378and CACHES are moved to parent. 380use_hierarchy==1), and no change on the charge except uncharging
379rmdir() may return -EBUSY if freeing/moving fails. See 5.1 also. 381from the child.
380 382
381Charges recorded in swap information is not updated at removal of cgroup. 383Charges recorded in swap information is not updated at removal of cgroup.
382Recorded information is discarded and a cgroup which uses swap (swapcache) 384Recorded information is discarded and a cgroup which uses swap (swapcache)
383will be charged as a new owner of it. 385will be charged as a new owner of it.
384 386
387About use_hierarchy, see Section 6.
385 388
3865. Misc. interfaces. 3895. 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
4045.2 stat file 4095.2 stat file
405 410
406memory.stat file includes following statistics 411memory.stat file includes following statistics
@@ -430,17 +435,10 @@ hierarchical_memory_limit - # of bytes of memory limit with regard to hierarchy
430hierarchical_memsw_limit - # of bytes of memory+swap limit with regard to 435hierarchical_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
433total_cache - sum of all children's "cache" 438total_<counter> - # hierarchical version of <counter>, which in
434total_rss - sum of all children's "rss" 439 addition to the cgroup's own value includes the
435total_mapped_file - sum of all children's "cache" 440 sum of all hierarchical children's values of
436total_pgpgin - sum of all children's "pgpgin" 441 <counter>, i.e. total_cache
437total_pgpgout - sum of all children's "pgpgout"
438total_swap - sum of all children's "swap"
439total_inactive_anon - sum of all children's "inactive_anon"
440total_active_anon - sum of all children's "active_anon"
441total_inactive_file - sum of all children's "inactive_file"
442total_active_file - sum of all children's "active_file"
443total_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
6378.3 TODO 6348.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