Skip to content

mm: memcontrol: recursive memory protection

Johannes Weiner cgroups linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 48 repliesIn review
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- improved Changelogs based on the discussion with Roman. Thanks!
- fix div0 when recursive & fixed protection is combined
- fix an unused compiler warning

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm: memcontrol: fix memory.low proportional distributionmm/memcontrol.c mm/page_counter.c+3 -133 replies
2/3mm: memcontrol: clean up and document effective low/min calculationsmm/memcontrol.c+104 -865 replies
3/3mm: memcontrol: recursive memory.low protectionDocumentation/admin-guide/cgroup-v2.rst include/linux/cgroup-defs.h kernel/cgroup/cgroup.c +1 more+93 -537 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchTejun HeoRoman GushchinChris DownMichal Hocko
SeriesA-b A-b A-b
1/3A-b A-b A-b A-b A-b
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/3] mm: memcontrol: recursive memory protection

Changes since v1:
- improved Changelogs based on the discussion with Roman. Thanks!
- fix div0 when recursive & fixed protection is combined
- fix an unused compiler warning

The current memory.low (and memory.min) semantics require protection to be assigned to a cgroup in an untinterrupted chain from the top-level cgroup all the way to the leaf.

In practice, we want to protect entire cgroup subtrees from each other (system management software vs. workload), but we would like the VM to balance memory optimally *within* each subtree, without having to make explicit weight allocations among individual components. The current semantics make that impossible.

This patch series extends memory.low/min such that the knobs apply recursively to the entire subtree. Users can still assign explicit protection to subgroups, but if they don't, the protection set by the parent cgroup will be distributed dynamically such that children compete freely - as if no memory control were enabled inside the subtree - but enjoy protection from neighboring trees.

Patch #1 fixes an existing bug that can give a cgroup tree more protection than it should receive as per ancestor configuration.

Patch #2 simplifies and documents the existing code to make it easier to reason about the changes in the next patch.

Patch #3 finally implements recursive memory protection semantics.

Because of a risk of regressing legacy setups, the new semantics are hidden behind a cgroup2 mount option, 'memory_recursiveprot'.

More details in patch #3.

 Documentation/admin-guide/cgroup-v2.rst |  11 ++
 include/linux/cgroup-defs.h             |   5 +
 kernel/cgroup/cgroup.c                  |  17 ++-
 mm/memcontrol.c                         | 243 +++++++++++++++++++-----------
 mm/page_counter.c                       |  12 +-
 5 files changed, 192 insertions(+), 96 deletions(-)