8.2.7 memory Parameters

The following memory parameters are defined:

memory.failcnt

Specifies the number of times that the amount of memory used by a cgroup has risen to memory.limit_in_bytes.

memory.force_empty

If a cgroup has no tasks, setting the value to 0 removes all pages from memory that were used by tasks in the cgroup. Setting the parameter in this way avoids a parent cgroup from being assigned the defunct page caches when you remove its child cgroup.

memory.limit_in_bytes

Specifies the maximum usage permitted for user memory including the file cache. The default units are bytes, but you can also specify a k or K, m or M, and g or G suffix for kilobytes, megabytes, and gigabytes respectively. A value of -1 removes the limit.

To avoid an out-of-memory error, set the value of memory.limit_in_bytes lower than memory.memsw.limit_in_bytes, and set memory.memsw.limit_in_bytes lower than the amount of available swap space.

memory.max_usage_in_bytes

Reports the maximum amount of user memory in bytes used by tasks in the cgroup.

memory.memsw.failcnt

Specifies the number of times that the amount of memory and swap space used by a cgroup has risen to memory.memsw.limit_in_bytes.

memory.memsw.limit_in_bytes

Specifies the maximum usage permitted for user memory plus swap space. The default units are bytes, but you can also specify a k or K, m or M, and g or G suffix for kilobytes, megabytes, and gigabytes respectively. A value of -1 removes the limit.

memory.memsw.max_usage_in_bytes

Reports the maximum amount of user memory and swap space in bytes used by tasks in the cgroup.

memory.memsw.usage_in_bytes

Reports the total size in bytes of the memory and swap space used by tasks in the cgroup.

memory.move_charge_at_immigrate

Specifies whether a task's charges are moved when you migrate the task between cgroups. You can specify the following values.

Setting

Description

0

Disable moving task charges.

1

Moves charges for an in-use or swapped-out anonymous page exclusively owned by the task.

2

Moves charges for file pages that are memory mapped by the task.

3

Equivalent to specifying both 1 and 2.

memory.numa_stat

Reports the NUMA memory usage in bytes for each memory node (N0, N1,...) together with the following statistics.

Statistic

Description

anon

The size in bytes of anonymous and swap cache.

file

The size in bytes of file-backed memory.

total

The sum of the anon, file and unevictable values.

unevictable

The size in bytes of unreclaimable memory.

memory.oom_control

Displays the values of the out-of-memory (OOM) notification control feature.

Setting

Description

oom_kill_disable

Whether the OOM killer is enabled (0) or disabled (1).

under_oom

Whether the cgroup is under OOM control (1) allowing tasks to be stopped, or not under OOM control (0).

memory.soft_limit_in_bytes

Specifies a soft, upper limit for user memory including the file cache. The default units are bytes, but you can also specify a k or K, m or M, and g or G suffix for kilobytes, megabytes, and gigabytes respectively. A value of -1 removes the limit.

The soft limit should be lower than the hard-limit value of memory.limit_in_bytes as the hard limit always takes precedence.

memory.stat

Reports the following memory statistics.

Statistic

Description

active_anon

The size in bytes of anonymous and swap cache on active least-recently-used (LRU) list (includes tmpfs).

active_file

The size in bytes of file-backed memory on active LRU list.

cache

The size in bytes of page cache (includes tmpfs).

hierarchical_memory_limit

The size in bytes of the limit of memory for the cgroup hierarchy.

hierarchical_memsw_limit

The size in bytes of the limit of memory plus swap for the cgroup hierarchy.

inactive_anon

The size in bytes of anonymous and swap cache on inactive LRU list (includes tmpfs).

inactive_file

The size in bytes of file-backed memory on inactive LRU list.

mapped_file

The size in bytes of memory-mapped files (includes tmpfs).

pgfault

The number of page faults, where the kernel has to allocate and initialize physical memory for use in the virtual address space of a process.

pgmajfault

The number of major page faults, where the kernel has to actively free physical memory before allocation and initialization.

pgpgin

The number of paged-in pages of memory.

pgpgout

The number of paged-out pages of memory.

rss

The size in bytes of anonymous and swap cache (does not include tmpfs). The actual resident set size is given by the sum of rss and mapped_file.

swap

The size in bytes of used swap space.

total_*

The value of the appended statistic for the cgroup and all of its children.

unevictable

The size in bytes of memory that in not reclaimable.

memory.swappiness

Specifies a bias value for the kernel to swap out memory pages used by processes in the cgroup rather than reclaim pages from the page cache. A value smaller than the default value of 60 reduces the kernel's preference for swapping out. A value greater than 60 increases the preference for swapping out. A value greater than 100 allows the system to swap out pages that fall within the address space of the cgroup's tasks.

memory.usage_in_bytes

Reports the total size in bytes of the memory used by all the tasks in the cgroup.

memory.use_hierarchy

Specifies whether the kernel should attempt to reclaim memory from a cgroup's hierarchy. The default value of 0 prevents memory from being reclaimed from other tasks in the hierarchy. A value of 1 allows memory to be reclaimed from other tasks in the hierarchy.