9

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.

  • 1
    As I said on SuperUser before you deleted the question there (next time, flag for moderator attention if you want a question migrated to another site in the StackExchange network), "the tasks in the children of the ancestor" is a fully contained subset of "the tasks in the ancestor". So by reclaiming from the tasks in the children you also automatically reclaim from tasks in the ancestor. I don't know whether or not it in fact is so, but it is a plausible reading of the text as written (although I agree it could be phrased much better). – a CVn Jul 5 '13 at 8:31
  • @Michael Kjörling thanks I will ask the moderator to move my question next time. Also, what you said make sense. – Amumu Jul 5 '13 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.