diff options
Diffstat (limited to 'Documentation/controllers/memory.txt')
-rw-r--r-- | Documentation/controllers/memory.txt | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt index 9fe2d0eabe05..05fe29ab1e58 100644 --- a/Documentation/controllers/memory.txt +++ b/Documentation/controllers/memory.txt | |||
@@ -137,12 +137,32 @@ behind this approach is that a cgroup that aggressively uses a shared | |||
137 | page will eventually get charged for it (once it is uncharged from | 137 | page will eventually get charged for it (once it is uncharged from |
138 | the cgroup that brought it in -- this will happen on memory pressure). | 138 | the cgroup that brought it in -- this will happen on memory pressure). |
139 | 139 | ||
140 | Exception: When you do swapoff and make swapped-out pages of shmem(tmpfs) to | 140 | Exception: If CONFIG_CGROUP_CGROUP_MEM_RES_CTLR_SWAP is not used.. |
141 | When you do swapoff and make swapped-out pages of shmem(tmpfs) to | ||
141 | be backed into memory in force, charges for pages are accounted against the | 142 | be backed into memory in force, charges for pages are accounted against the |
142 | caller of swapoff rather than the users of shmem. | 143 | caller of swapoff rather than the users of shmem. |
143 | 144 | ||
144 | 145 | ||
145 | 2.4 Reclaim | 146 | 2.4 Swap Extension (CONFIG_CGROUP_MEM_RES_CTLR_SWAP) |
147 | Swap Extension allows you to record charge for swap. A swapped-in page is | ||
148 | charged back to original page allocator if possible. | ||
149 | |||
150 | When swap is accounted, following files are added. | ||
151 | - memory.memsw.usage_in_bytes. | ||
152 | - memory.memsw.limit_in_bytes. | ||
153 | |||
154 | usage of mem+swap is limited by memsw.limit_in_bytes. | ||
155 | |||
156 | Note: why 'mem+swap' rather than swap. | ||
157 | The global LRU(kswapd) can swap out arbitrary pages. Swap-out means | ||
158 | to move account from memory to swap...there is no change in usage of | ||
159 | mem+swap. | ||
160 | |||
161 | In other words, when we want to limit the usage of swap without affecting | ||
162 | global LRU, mem+swap limit is better than just limiting swap from OS point | ||
163 | of view. | ||
164 | |||
165 | 2.5 Reclaim | ||
146 | 166 | ||
147 | Each cgroup maintains a per cgroup LRU that consists of an active | 167 | Each cgroup maintains a per cgroup LRU that consists of an active |
148 | and inactive list. When a cgroup goes over its limit, we first try | 168 | and inactive list. When a cgroup goes over its limit, we first try |
@@ -246,6 +266,11 @@ Such charges are freed(at default) or moved to its parent. When moved, | |||
246 | both of RSS and CACHES are moved to parent. | 266 | both of RSS and CACHES are moved to parent. |
247 | If both of them are busy, rmdir() returns -EBUSY. See 5.1 Also. | 267 | If both of them are busy, rmdir() returns -EBUSY. See 5.1 Also. |
248 | 268 | ||
269 | Charges recorded in swap information is not updated at removal of cgroup. | ||
270 | Recorded information is discarded and a cgroup which uses swap (swapcache) | ||
271 | will be charged as a new owner of it. | ||
272 | |||
273 | |||
249 | 5. Misc. interfaces. | 274 | 5. Misc. interfaces. |
250 | 275 | ||
251 | 5.1 force_empty | 276 | 5.1 force_empty |