Skip to content

Commit da3ad2e

Browse files
bagasmehtejun
authored andcommitted
docs: cgroup-v1: add internal cross-references
The documentation contains references to other sections in the doc (internal). Add cross-references for them so that these can be accessed without having to manually search for them. Signed-off-by: Bagas Sanjaya <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 5fa16af commit da3ad2e

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

Documentation/admin-guide/cgroup-v1/memory.rst

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ Features:
5555
- Root cgroup has no limit controls.
5656

5757
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>`)
5960

6061
Brief summary of control files.
6162

@@ -221,8 +222,9 @@ behind this approach is that a cgroup that aggressively uses a shared
221222
page will eventually get charged for it (once it is uncharged from
222223
the cgroup that brought it in -- this will happen on memory pressure).
223224

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.
226228

227229
2.4 Swap Extension
228230
--------------------------------------
@@ -270,7 +272,7 @@ global VM. When a cgroup goes over its limit, we first try
270272
to reclaim memory from the cgroup so as to make space for the new
271273
pages that the cgroup has touched. If the reclaim is unsuccessful,
272274
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.)
274276

275277
The reclaim algorithm has not been modified for cgroups, except that
276278
pages that are selected for reclaiming come from the per-cgroup LRU
@@ -284,7 +286,7 @@ list.
284286
When panic_on_oom is set to "2", the whole system will panic.
285287

286288
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)
288290

289291
2.6 Locking
290292
-----------
@@ -301,6 +303,8 @@ Per-node-per-memcgroup LRU (cgroup's private LRU) is guarded by
301303
lruvec->lru_lock; PG_lru bit of page->flags is cleared before
302304
isolating a page from its LRU under lruvec->lru_lock.
303305

306+
.. _cgroup-v1-memory-kernel-extension:
307+
304308
2.7 Kernel Memory Extension
305309
-----------------------------------------------
306310

@@ -460,6 +464,8 @@ test because it has noise of shared objects/status.
460464
But the above two are testing extreme situations.
461465
Trying usual test under memory controller is always helpful.
462466

467+
.. _cgroup-v1-memory-test-troubleshoot:
468+
463469
4.1 Troubleshooting
464470
-------------------
465471

@@ -472,8 +478,11 @@ terminated by the OOM killer. There are several causes for this:
472478
A sync followed by echo 1 > /proc/sys/vm/drop_caches will help get rid of
473479
some of the pages cached in the cgroup (page cache pages).
474480

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:
477486

478487
4.2 Task migration
479488
------------------
@@ -484,15 +493,16 @@ remain charged to it, the charge is dropped when the page is freed or
484493
reclaimed.
485494

486495
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>`
488497

489498
4.3 Removing a cgroup
490499
---------------------
491500

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.)
496506

497507
We move the stats to parent, and no change on the charge except uncharging
498508
from the child.
@@ -719,6 +729,8 @@ If we want to change this to 1G, we can at any time use::
719729
It is recommended to set the soft limit always below the hard limit,
720730
otherwise the hard limit will take precedence.
721731

732+
.. _cgroup-v1-memory-move-charges:
733+
722734
8. Move charges at task migration
723735
=================================
724736

@@ -739,7 +751,8 @@ If you want to enable it::
739751

740752
.. note::
741753
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.
743756

744757
.. note::
745758
Charges are moved only when you move mm->owner, in other words,
@@ -757,6 +770,8 @@ And if you want disable it again::
757770

758771
# echo 0 > memory.move_charge_at_immigrate
759772

773+
.. _cgroup-v1-memory-movable-charges:
774+
760775
8.2 Type of charges which can be moved
761776
--------------------------------------
762777

@@ -806,6 +821,8 @@ threshold in any direction.
806821

807822
It's applicable for root and non-root cgroup.
808823

824+
.. _cgroup-v1-memory-oom-control:
825+
809826
10. OOM Control
810827
===============
811828

0 commit comments

Comments
 (0)