@@ -55,7 +55,8 @@ Features:
55
55
- Root cgroup has no limit controls.
56
56
57
57
Kernel memory support is a work in progress, and the current version provides
58
- basically functionality. (See Section 2.7)
58
+ basically functionality. (See :ref: `section 2.7
59
+ <cgroup-v1-memory-kernel-extension>`)
59
60
60
61
Brief summary of control files.
61
62
@@ -221,8 +222,9 @@ behind this approach is that a cgroup that aggressively uses a shared
221
222
page will eventually get charged for it (once it is uncharged from
222
223
the cgroup that brought it in -- this will happen on memory pressure).
223
224
224
- But see section 8.2: when moving a task to another cgroup, its pages may
225
- be recharged to the new cgroup, if move_charge_at_immigrate has been chosen.
225
+ But see :ref: `section 8.2 <cgroup-v1-memory-movable-charges >` when moving a
226
+ task to another cgroup, its pages may be recharged to the new cgroup, if
227
+ move_charge_at_immigrate has been chosen.
226
228
227
229
2.4 Swap Extension
228
230
--------------------------------------
@@ -270,7 +272,7 @@ global VM. When a cgroup goes over its limit, we first try
270
272
to reclaim memory from the cgroup so as to make space for the new
271
273
pages that the cgroup has touched. If the reclaim is unsuccessful,
272
274
an OOM routine is invoked to select and kill the bulkiest task in the
273
- cgroup. (See 10. OOM Control below.)
275
+ cgroup. (See :ref: ` 10. OOM Control < cgroup-v1-memory-oom-control >` below.)
274
276
275
277
The reclaim algorithm has not been modified for cgroups, except that
276
278
pages that are selected for reclaiming come from the per-cgroup LRU
@@ -284,7 +286,7 @@ list.
284
286
When panic_on_oom is set to "2", the whole system will panic.
285
287
286
288
When oom event notifier is registered, event will be delivered.
287
- (See oom_control section)
289
+ (See :ref: ` oom_control < cgroup-v1-memory-oom-control >` section)
288
290
289
291
2.6 Locking
290
292
-----------
@@ -301,6 +303,8 @@ Per-node-per-memcgroup LRU (cgroup's private LRU) is guarded by
301
303
lruvec->lru_lock; PG_lru bit of page->flags is cleared before
302
304
isolating a page from its LRU under lruvec->lru_lock.
303
305
306
+ .. _cgroup-v1-memory-kernel-extension :
307
+
304
308
2.7 Kernel Memory Extension
305
309
-----------------------------------------------
306
310
@@ -460,6 +464,8 @@ test because it has noise of shared objects/status.
460
464
But the above two are testing extreme situations.
461
465
Trying usual test under memory controller is always helpful.
462
466
467
+ .. _cgroup-v1-memory-test-troubleshoot :
468
+
463
469
4.1 Troubleshooting
464
470
-------------------
465
471
@@ -472,8 +478,11 @@ terminated by the OOM killer. There are several causes for this:
472
478
A sync followed by echo 1 > /proc/sys/vm/drop_caches will help get rid of
473
479
some of the pages cached in the cgroup (page cache pages).
474
480
475
- To know what happens, disabling OOM_Kill as per "10. OOM Control" (below) and
476
- seeing what happens will be helpful.
481
+ To know what happens, disabling OOM_Kill as per :ref: `"10. OOM Control"
482
+ <cgroup-v1-memory-oom-control>` (below) and seeing what happens will be
483
+ helpful.
484
+
485
+ .. _cgroup-v1-memory-test-task-migration :
477
486
478
487
4.2 Task migration
479
488
------------------
@@ -484,15 +493,16 @@ remain charged to it, the charge is dropped when the page is freed or
484
493
reclaimed.
485
494
486
495
You can move charges of a task along with task migration.
487
- See 8. "Move charges at task migration"
496
+ See :ref: ` 8. "Move charges at task migration" < cgroup-v1-memory-move-charges >`
488
497
489
498
4.3 Removing a cgroup
490
499
---------------------
491
500
492
- A cgroup can be removed by rmdir, but as discussed in sections 4.1 and 4.2, a
493
- cgroup might have some charge associated with it, even though all
494
- tasks have migrated away from it. (because we charge against pages, not
495
- against tasks.)
501
+ A cgroup can be removed by rmdir, but as discussed in :ref: `sections 4.1
502
+ <cgroup-v1-memory-test-troubleshoot>` and :ref: `4.2
503
+ <cgroup-v1-memory-test-task-migration>`, a cgroup might have some charge
504
+ associated with it, even though all tasks have migrated away from it. (because
505
+ we charge against pages, not against tasks.)
496
506
497
507
We move the stats to parent, and no change on the charge except uncharging
498
508
from the child.
@@ -719,6 +729,8 @@ If we want to change this to 1G, we can at any time use::
719
729
It is recommended to set the soft limit always below the hard limit,
720
730
otherwise the hard limit will take precedence.
721
731
732
+ .. _cgroup-v1-memory-move-charges :
733
+
722
734
8. Move charges at task migration
723
735
=================================
724
736
@@ -739,7 +751,8 @@ If you want to enable it::
739
751
740
752
.. note ::
741
753
Each bits of move_charge_at_immigrate has its own meaning about what type
742
- of charges should be moved. See 8.2 for details.
754
+ of charges should be moved. See :ref: `section 8.2
755
+ <cgroup-v1-memory-movable-charges>` for details.
743
756
744
757
.. note ::
745
758
Charges are moved only when you move mm->owner, in other words,
@@ -757,6 +770,8 @@ And if you want disable it again::
757
770
758
771
# echo 0 > memory.move_charge_at_immigrate
759
772
773
+ .. _cgroup-v1-memory-movable-charges :
774
+
760
775
8.2 Type of charges which can be moved
761
776
--------------------------------------
762
777
@@ -806,6 +821,8 @@ threshold in any direction.
806
821
807
822
It's applicable for root and non-root cgroup.
808
823
824
+ .. _cgroup-v1-memory-oom-control :
825
+
809
826
10. OOM Control
810
827
===============
811
828
0 commit comments