diff options
| -rw-r--r-- | Documentation/cgroups/memory.txt | 6 | ||||
| -rw-r--r-- | mm/memcontrol.c | 7 |
2 files changed, 1 insertions, 12 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 2622115276aa..8cb87e32e8cb 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
| @@ -453,15 +453,11 @@ About use_hierarchy, see Section 6. | |||
| 453 | 453 | ||
| 454 | 5.1 force_empty | 454 | 5.1 force_empty |
| 455 | memory.force_empty interface is provided to make cgroup's memory usage empty. | 455 | memory.force_empty interface is provided to make cgroup's memory usage empty. |
| 456 | You can use this interface only when the cgroup has no tasks. | ||
| 457 | When writing anything to this | 456 | When writing anything to this |
| 458 | 457 | ||
| 459 | # echo 0 > memory.force_empty | 458 | # echo 0 > memory.force_empty |
| 460 | 459 | ||
| 461 | Almost all pages tracked by this memory cgroup will be unmapped and freed. | 460 | the cgroup will be reclaimed and as many pages reclaimed as possible. |
| 462 | Some pages cannot be freed because they are locked or in-use. Such pages are | ||
| 463 | moved to parent (if use_hierarchy==1) or root (if use_hierarchy==0) and this | ||
| 464 | cgroup will be empty. | ||
| 465 | 461 | ||
| 466 | The typical use case for this interface is before calling rmdir(). | 462 | The typical use case for this interface is before calling rmdir(). |
| 467 | Because rmdir() moves all pages to parent, some out-of-use page caches can be | 463 | Because rmdir() moves all pages to parent, some out-of-use page caches can be |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a5e0417b4f9a..6144a8e7283f 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -4857,11 +4857,6 @@ static inline bool memcg_has_children(struct mem_cgroup *memcg) | |||
| 4857 | static int mem_cgroup_force_empty(struct mem_cgroup *memcg) | 4857 | static int mem_cgroup_force_empty(struct mem_cgroup *memcg) |
| 4858 | { | 4858 | { |
| 4859 | int nr_retries = MEM_CGROUP_RECLAIM_RETRIES; | 4859 | int nr_retries = MEM_CGROUP_RECLAIM_RETRIES; |
| 4860 | struct cgroup *cgrp = memcg->css.cgroup; | ||
| 4861 | |||
| 4862 | /* returns EBUSY if there is a task or if we come here twice. */ | ||
| 4863 | if (cgroup_has_tasks(cgrp) || !list_empty(&cgrp->children)) | ||
| 4864 | return -EBUSY; | ||
| 4865 | 4860 | ||
| 4866 | /* we call try-to-free pages for make this cgroup empty */ | 4861 | /* we call try-to-free pages for make this cgroup empty */ |
| 4867 | lru_add_drain_all(); | 4862 | lru_add_drain_all(); |
| @@ -4881,8 +4876,6 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg) | |||
| 4881 | } | 4876 | } |
| 4882 | 4877 | ||
| 4883 | } | 4878 | } |
| 4884 | lru_add_drain(); | ||
| 4885 | mem_cgroup_reparent_charges(memcg); | ||
| 4886 | 4879 | ||
| 4887 | return 0; | 4880 | return 0; |
| 4888 | } | 4881 | } |
