diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-02-07 03:13:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:18 -0500 |
commit | 0eea10301708c64a6b793894c156e21ddd15eb64 (patch) | |
tree | a0dcbe47d48d35ec0554faa5f86068cfab94ca6e /Documentation/controllers | |
parent | 66e1707bc34609f626e2e7b4fe7e454c9748bad5 (diff) |
Memory controller improve user interface
Change the interface to use bytes instead of pages. Page sizes can vary
across platforms and configurations. A new strategy routine has been added
to the resource counters infrastructure to format the data as desired.
Suggested by David Rientjes, Andrew Morton and Herbert Poetzl
Tested on a UML setup with the config for memory control enabled.
[kamezawa.hiroyu@jp.fujitsu.com: possible race fix in res_counter]
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Cc: Paul Menage <menage@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Kirill Korotaev <dev@sw.ru>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: David Rientjes <rientjes@google.com>
Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@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/controllers')
-rw-r--r-- | Documentation/controllers/memory.txt | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt index 7e27baacca7..61df8f81c80 100644 --- a/Documentation/controllers/memory.txt +++ b/Documentation/controllers/memory.txt | |||
@@ -165,11 +165,30 @@ c. Enable CONFIG_CGROUP_MEM_CONT | |||
165 | 165 | ||
166 | Since now we're in the 0 cgroup, | 166 | Since now we're in the 0 cgroup, |
167 | We can alter the memory limit: | 167 | We can alter the memory limit: |
168 | # echo -n 6000 > /cgroups/0/memory.limit | 168 | # echo -n 4M > /cgroups/0/memory.limit_in_bytes |
169 | |||
170 | NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo, | ||
171 | mega or gigabytes. | ||
172 | |||
173 | # cat /cgroups/0/memory.limit_in_bytes | ||
174 | 4194304 Bytes | ||
175 | |||
176 | NOTE: The interface has now changed to display the usage in bytes | ||
177 | instead of pages | ||
169 | 178 | ||
170 | We can check the usage: | 179 | We can check the usage: |
171 | # cat /cgroups/0/memory.usage | 180 | # cat /cgroups/0/memory.usage_in_bytes |
172 | 25 | 181 | 1216512 Bytes |
182 | |||
183 | A successful write to this file does not guarantee a successful set of | ||
184 | this limit to the value written into the file. This can be due to a | ||
185 | number of factors, such as rounding up to page boundaries or the total | ||
186 | availability of memory on the system. The user is required to re-read | ||
187 | this file after a write to guarantee the value committed by the kernel. | ||
188 | |||
189 | # echo -n 1 > memory.limit_in_bytes | ||
190 | # cat memory.limit_in_bytes | ||
191 | 4096 Bytes | ||
173 | 192 | ||
174 | The memory.failcnt field gives the number of times that the cgroup limit was | 193 | The memory.failcnt field gives the number of times that the cgroup limit was |
175 | exceeded. | 194 | exceeded. |
@@ -206,8 +225,8 @@ cgroup might have some charge associated with it, even though all | |||
206 | tasks have migrated away from it. If some pages are still left, after following | 225 | tasks have migrated away from it. If some pages are still left, after following |
207 | the steps listed in sections 4.1 and 4.2, check the Swap Cache usage in | 226 | the steps listed in sections 4.1 and 4.2, check the Swap Cache usage in |
208 | /proc/meminfo to see if the Swap Cache usage is showing up in the | 227 | /proc/meminfo to see if the Swap Cache usage is showing up in the |
209 | cgroups memory.usage counter. A simple test of swapoff -a and swapon -a | 228 | cgroups memory.usage_in_bytes counter. A simple test of swapoff -a and |
210 | should free any pending Swap Cache usage. | 229 | swapon -a should free any pending Swap Cache usage. |
211 | 230 | ||
212 | 4.4 Choosing what to account -- Page Cache (unmapped) vs RSS (mapped)? | 231 | 4.4 Choosing what to account -- Page Cache (unmapped) vs RSS (mapped)? |
213 | 232 | ||