|author||Balbir Singh <email@example.com>||2009-09-23 15:56:34 -0700|
|committer||Linus Torvalds <firstname.lastname@example.org>||2009-09-24 07:20:59 -0700|
memory controller: soft limit documentation
Soft limits is a new feature for the memory resource controller, something similar has existed in the group scheduler in the form of shares. The CPU controllers interpretation of shares is very different though. Soft limits are the most useful feature to have for environments where the administrator wants to overcommit the system, such that only on memory contention do the limits become active. The current soft limits implementation provides a soft_limit_in_bytes interface for the memory controller and not for memory+swap controller. The implementation maintains an RB-Tree of groups that exceed their soft limit and starts reclaiming from the group that exceeds this limit by the maximum amount. This patch: Add documentation for soft limits Signed-off-by: Balbir Singh <email@example.com> Cc: KAMEZAWA Hiroyuki <firstname.lastname@example.org> Cc: Li Zefan <email@example.com> Cc: KOSAKI Motohiro <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Diffstat (limited to 'Documentation/cgroups')
1 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
index ab0a02172cf..b871f2552b4 100644
@@ -379,7 +379,42 @@ cgroups created below it.
NOTE2: This feature can be enabled/disabled per subtree.
+7. Soft limits
+Soft limits allow for greater sharing of memory. The idea behind soft limits
+is to allow control groups to use as much of the memory as needed, provided
+a. There is no memory contention
+b. They do not exceed their hard limit
+When the system detects memory contention or low memory control groups
+are pushed back to their soft limits. If the soft limit of each control
+group is very high, they are pushed back as much as possible to make
+sure that one control group does not starve the others of memory.
+Please note that soft limits is a best effort feature, it comes with
+no guarantees, but it does its best to make sure that when memory is
+heavily contended for, memory is allocated based on the soft limit
+hints/setup. Currently soft limit based reclaim is setup such that
+it gets invoked from balance_pgdat (kswapd).
+Soft limits can be setup by using the following commands (in this example we
+assume a soft limit of 256 megabytes)
+# echo 256M > memory.soft_limit_in_bytes
+If we want to change this to 1G, we can at any time use
+# echo 1G > memory.soft_limit_in_bytes
+NOTE1: Soft limits take effect over a long period of time, since they involve
+ reclaiming memory for balancing between memory cgroups
+NOTE2: It is recommended to set the soft limit always below the hard limit,
+ otherwise the hard limit will take precedence.
1. Add support for accounting huge pages (as a separate controller)
2. Make per-cgroup scanner reclaim not-shared pages first