diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 848fc6c195d2..46717d6c62b7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -864,9 +864,15 @@ static void mem_cgroup_update_soft_limit(struct mem_cgroup *memcg) | |||
864 | /* | 864 | /* |
865 | * Necessary to update all ancestors when hierarchy is used | 865 | * Necessary to update all ancestors when hierarchy is used |
866 | * because their event counter is not touched. | 866 | * because their event counter is not touched. |
867 | * We track children even outside the hierarchy for the root | ||
868 | * cgroup because tree walk starting at root should visit | ||
869 | * all cgroups and we want to prevent from pointless tree | ||
870 | * walk if no children is below the limit. | ||
867 | */ | 871 | */ |
868 | while (delta && (parent = parent_mem_cgroup(parent))) | 872 | while (delta && (parent = parent_mem_cgroup(parent))) |
869 | atomic_add(delta, &parent->children_in_excess); | 873 | atomic_add(delta, &parent->children_in_excess); |
874 | if (memcg != root_mem_cgroup && !root_mem_cgroup->use_hierarchy) | ||
875 | atomic_add(delta, &root_mem_cgroup->children_in_excess); | ||
870 | spin_unlock(&memcg->soft_lock); | 876 | spin_unlock(&memcg->soft_lock); |
871 | } | 877 | } |
872 | 878 | ||
@@ -6043,6 +6049,9 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
6043 | if (memcg->soft_contributed) { | 6049 | if (memcg->soft_contributed) { |
6044 | while ((memcg = parent_mem_cgroup(memcg))) | 6050 | while ((memcg = parent_mem_cgroup(memcg))) |
6045 | atomic_dec(&memcg->children_in_excess); | 6051 | atomic_dec(&memcg->children_in_excess); |
6052 | |||
6053 | if (memcg != root_mem_cgroup && !root_mem_cgroup->use_hierarchy) | ||
6054 | atomic_dec(&root_mem_cgroup->children_in_excess); | ||
6046 | } | 6055 | } |
6047 | mem_cgroup_destroy_all_caches(memcg); | 6056 | mem_cgroup_destroy_all_caches(memcg); |
6048 | vmpressure_cleanup(&memcg->vmpressure); | 6057 | vmpressure_cleanup(&memcg->vmpressure); |