cgroup has 2 options for memory control:
memory.use_hierarchy = 1: use hierarchy
memory.use_hierarchy = 0: use flat hierarchy, according to this answer
What is the difference between the two? I think, hierarchy is hierarchy, what does "flat" mean here?
I read the cgroup documentation here explained the hierarchical support:
In the diagram above, with hierarchical accounting enabled, all memory usage of e, is accounted to its ancestors up until the root (i.e, c and root), that has memory.use_hierarchy enabled. If one of the ancestors goes over its limit, the reclaim algorithm reclaims from the tasks in the ancestor and the children of the ancestor.
- What does it mean by
accounted to its ancestors up until the root?
- How can ancestors can go over its limit, since its children capacities are allocated that sum to the capacity of the ancestor?
- Why are tasks reclaimed in both ancestor and children? I thought that tasks are only allocated in the children and those tasks automatically belong to ancestor. i.e. "WWW Browsing" has 20% capacity; its children are "Professors" and "Students" that have 15% and 5% respectively. The maximum can never exceed 20%. Why is there a case in the document stated that:
If one of the ancestors goes over its limit, the reclaim algorithm reclaims from the tasks in the ancestor and the children of the ancestor.