diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2016-01-20 18:02:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-20 20:09:18 -0500 |
commit | b15aac110a45c52d7f47ab8ee2d68f98044cfe6c (patch) | |
tree | 1cfa36fc2070f647841100f15ce953268a7ad86b /mm | |
parent | 6d378dac7c4905db38f8127c4e618f0f627a4ced (diff) |
mm: memcontrol: remove double kmem page_counter init
The kmem page_counter's limit is initialized to PAGE_COUNTER_MAX inside
mem_cgroup_css_online(). There is no need to repeat this from
memcg_propagate_kmem().
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f21f29cd14f9..71dced17b16d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2861,8 +2861,7 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, | |||
2861 | } | 2861 | } |
2862 | 2862 | ||
2863 | #ifdef CONFIG_MEMCG_KMEM | 2863 | #ifdef CONFIG_MEMCG_KMEM |
2864 | static int memcg_activate_kmem(struct mem_cgroup *memcg, | 2864 | static int memcg_activate_kmem(struct mem_cgroup *memcg) |
2865 | unsigned long nr_pages) | ||
2866 | { | 2865 | { |
2867 | int err = 0; | 2866 | int err = 0; |
2868 | int memcg_id; | 2867 | int memcg_id; |
@@ -2897,13 +2896,6 @@ static int memcg_activate_kmem(struct mem_cgroup *memcg, | |||
2897 | goto out; | 2896 | goto out; |
2898 | } | 2897 | } |
2899 | 2898 | ||
2900 | /* | ||
2901 | * We couldn't have accounted to this cgroup, because it hasn't got | ||
2902 | * activated yet, so this should succeed. | ||
2903 | */ | ||
2904 | err = page_counter_limit(&memcg->kmem, nr_pages); | ||
2905 | VM_BUG_ON(err); | ||
2906 | |||
2907 | static_branch_inc(&memcg_kmem_enabled_key); | 2899 | static_branch_inc(&memcg_kmem_enabled_key); |
2908 | /* | 2900 | /* |
2909 | * A memory cgroup is considered kmem-active as soon as it gets | 2901 | * A memory cgroup is considered kmem-active as soon as it gets |
@@ -2924,10 +2916,14 @@ static int memcg_update_kmem_limit(struct mem_cgroup *memcg, | |||
2924 | int ret; | 2916 | int ret; |
2925 | 2917 | ||
2926 | mutex_lock(&memcg_limit_mutex); | 2918 | mutex_lock(&memcg_limit_mutex); |
2927 | if (!memcg_kmem_is_active(memcg)) | 2919 | /* Top-level cgroup doesn't propagate from root */ |
2928 | ret = memcg_activate_kmem(memcg, limit); | 2920 | if (!memcg_kmem_is_active(memcg)) { |
2929 | else | 2921 | ret = memcg_activate_kmem(memcg); |
2930 | ret = page_counter_limit(&memcg->kmem, limit); | 2922 | if (ret) |
2923 | goto out; | ||
2924 | } | ||
2925 | ret = page_counter_limit(&memcg->kmem, limit); | ||
2926 | out: | ||
2931 | mutex_unlock(&memcg_limit_mutex); | 2927 | mutex_unlock(&memcg_limit_mutex); |
2932 | return ret; | 2928 | return ret; |
2933 | } | 2929 | } |
@@ -2946,7 +2942,7 @@ static int memcg_propagate_kmem(struct mem_cgroup *memcg) | |||
2946 | * after this point, because it has at least one child already. | 2942 | * after this point, because it has at least one child already. |
2947 | */ | 2943 | */ |
2948 | if (memcg_kmem_is_active(parent)) | 2944 | if (memcg_kmem_is_active(parent)) |
2949 | ret = memcg_activate_kmem(memcg, PAGE_COUNTER_MAX); | 2945 | ret = memcg_activate_kmem(memcg); |
2950 | mutex_unlock(&memcg_limit_mutex); | 2946 | mutex_unlock(&memcg_limit_mutex); |
2951 | return ret; | 2947 | return ret; |
2952 | } | 2948 | } |