Search code examples
cgroups

How can I check what the cgroups option memory.use_hierarchy is set to?


I'm trying to figure out if the cgroups option memory.use_hierarchy is set to true or false (1 or 0). Is there some standard file this is listed in or a command I can use to figure this out? If it is not set anywhere, is there a default setting for this?


Solution

  • memory.use_hierarchy is set to 0 by default.

    A file called memory.use_hierarchy exists in cgroup virtual file system to retrieve/configure this option. To enable this option, you simply write '1' to this file. Likewise to disable this option, you write '0' to this file. For example: if you have a cgroup called 'test' in your cgroup virtual file system, you enable memory.use_hierarchy by doing:

    $ echo 1 > test/memory.use_hierarchy

    And you turn it off by doing:

    $ echo 0 > test/memory.use_hierarchy

    To read the value in this file, you can use 'cat':

    $ cat test/memory.use_hierarchy