diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-09-23 18:56:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-24 10:20:59 -0400 |
commit | a6df63615b943dbef22df04c19f4506330fe835e (patch) | |
tree | cd1b0ca72533a37d224d1424a5309f1924afe20b /Documentation | |
parent | 261fb61a8bf6d3bd964ae6f1e6af49585d30db51 (diff) |
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 <balbir@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/cgroups/memory.txt | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index ab0a02172cf4..b871f2552b45 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -379,7 +379,42 @@ cgroups created below it. | |||
379 | 379 | ||
380 | NOTE2: This feature can be enabled/disabled per subtree. | 380 | NOTE2: This feature can be enabled/disabled per subtree. |
381 | 381 | ||
382 | 7. TODO | 382 | 7. Soft limits |
383 | |||
384 | Soft limits allow for greater sharing of memory. The idea behind soft limits | ||
385 | is to allow control groups to use as much of the memory as needed, provided | ||
386 | |||
387 | a. There is no memory contention | ||
388 | b. They do not exceed their hard limit | ||
389 | |||
390 | When the system detects memory contention or low memory control groups | ||
391 | are pushed back to their soft limits. If the soft limit of each control | ||
392 | group is very high, they are pushed back as much as possible to make | ||
393 | sure that one control group does not starve the others of memory. | ||
394 | |||
395 | Please note that soft limits is a best effort feature, it comes with | ||
396 | no guarantees, but it does its best to make sure that when memory is | ||
397 | heavily contended for, memory is allocated based on the soft limit | ||
398 | hints/setup. Currently soft limit based reclaim is setup such that | ||
399 | it gets invoked from balance_pgdat (kswapd). | ||
400 | |||
401 | 7.1 Interface | ||
402 | |||
403 | Soft limits can be setup by using the following commands (in this example we | ||
404 | assume a soft limit of 256 megabytes) | ||
405 | |||
406 | # echo 256M > memory.soft_limit_in_bytes | ||
407 | |||
408 | If we want to change this to 1G, we can at any time use | ||
409 | |||
410 | # echo 1G > memory.soft_limit_in_bytes | ||
411 | |||
412 | NOTE1: Soft limits take effect over a long period of time, since they involve | ||
413 | reclaiming memory for balancing between memory cgroups | ||
414 | NOTE2: It is recommended to set the soft limit always below the hard limit, | ||
415 | otherwise the hard limit will take precedence. | ||
416 | |||
417 | 8. TODO | ||
383 | 418 | ||
384 | 1. Add support for accounting huge pages (as a separate controller) | 419 | 1. Add support for accounting huge pages (as a separate controller) |
385 | 2. Make per-cgroup scanner reclaim not-shared pages first | 420 | 2. Make per-cgroup scanner reclaim not-shared pages first |