diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2012-05-29 18:07:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:27 -0400 |
commit | cc926f78420705817b807dbec0c5d3643827eba3 (patch) | |
tree | fea47aea4b5963fbf06e77c593abeee3afb1958b /Documentation | |
parent | d01dd17f1067ca50dbb9d1d3400d33221ce339e7 (diff) |
memcg: move charges to root cgroup if use_hierarchy=0
Presently, at removal of cgroup, ->pre_destroy() is called and moves
charges to the parent cgroup. A major reason for returning -EBUSY from
->pre_destroy() is that the 'moving' hits the parent's resource
limitation. It happens only when use_hierarchy=0.
Considering use_hierarchy=0, all cgroups should be flat. So, no one
cannot justify moving charges to parent...parent and children are in flat
configuration, not hierarchical.
This patch modifes the code to move charges to the root cgroup at
rmdir/force_empty if use_hierarchy==0. This will much simplify rmdir()
and reduce error in ->pre_destroy.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ying Han <yinghan@google.com>
Cc: Glauber Costa <glommer@parallels.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
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 | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 6a066a270fc5..dd88540bb995 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -376,14 +376,15 @@ cgroup might have some charge associated with it, even though all | |||
376 | tasks have migrated away from it. (because we charge against pages, not | 376 | tasks have migrated away from it. (because we charge against pages, not |
377 | against tasks.) | 377 | against tasks.) |
378 | 378 | ||
379 | Such charges are freed or moved to their parent. At moving, both of RSS | 379 | We move the stats to root (if use_hierarchy==0) or parent (if |
380 | and CACHES are moved to parent. | 380 | use_hierarchy==1), and no change on the charge except uncharging |
381 | rmdir() may return -EBUSY if freeing/moving fails. See 5.1 also. | 381 | from the child. |
382 | 382 | ||
383 | Charges recorded in swap information is not updated at removal of cgroup. | 383 | Charges recorded in swap information is not updated at removal of cgroup. |
384 | Recorded information is discarded and a cgroup which uses swap (swapcache) | 384 | Recorded information is discarded and a cgroup which uses swap (swapcache) |
385 | will be charged as a new owner of it. | 385 | will be charged as a new owner of it. |
386 | 386 | ||
387 | About use_hierarchy, see Section 6. | ||
387 | 388 | ||
388 | 5. Misc. interfaces. | 389 | 5. Misc. interfaces. |
389 | 390 | ||
@@ -396,13 +397,15 @@ will be charged as a new owner of it. | |||
396 | 397 | ||
397 | Almost all pages tracked by this memory cgroup will be unmapped and freed. | 398 | Almost all pages tracked by this memory cgroup will be unmapped and freed. |
398 | Some pages cannot be freed because they are locked or in-use. Such pages are | 399 | Some pages cannot be freed because they are locked or in-use. Such pages are |
399 | moved to parent and this cgroup will be empty. This may return -EBUSY if | 400 | moved to parent(if use_hierarchy==1) or root (if use_hierarchy==0) and this |
400 | VM is too busy to free/move all pages immediately. | 401 | cgroup will be empty. |
401 | 402 | ||
402 | Typical use case of this interface is that calling this before rmdir(). | 403 | Typical use case of this interface is that calling this before rmdir(). |
403 | Because rmdir() moves all pages to parent, some out-of-use page caches can be | 404 | Because rmdir() moves all pages to parent, some out-of-use page caches can be |
404 | moved to the parent. If you want to avoid that, force_empty will be useful. | 405 | moved to the parent. If you want to avoid that, force_empty will be useful. |
405 | 406 | ||
407 | About use_hierarchy, see Section 6. | ||
408 | |||
406 | 5.2 stat file | 409 | 5.2 stat file |
407 | 410 | ||
408 | memory.stat file includes following statistics | 411 | memory.stat file includes following statistics |