提交 520bea64 编写于 作者: R Roman Gushchin 提交者: Yang Yingliang

mm: memcg/slab: don't check the dying flag on kmem_cache creation

mainline inclusion
from mainline-5.3-rc1
commit 57033297
category: bugfix
bugzilla: 34611
CVE: NA

-------------------------------------------------
There is no point in checking the root_cache->memcg_params.dying flag on
kmem_cache creation path.  New allocations shouldn't be performed using a
dead root kmem_cache, so no new memcg kmem_cache creation can be scheduled
after the flag is set.  And if it was scheduled before,
flush_memcg_workqueue() will wait for it anyway.

So let's drop this check to simplify the code.

Link: http://lkml.kernel.org/r/20190611231813.3148843-7-guro@fb.comSigned-off-by: NRoman Gushchin <guro@fb.com>
Acked-by: NVladimir Davydov <vdavydov.dev@gmail.com>
Reviewed-by: NShakeel Butt <shakeelb@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Waiman Long <longman@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Andrei Vagin <avagin@gmail.com>
Cc: Qian Cai <cai@lca.pw>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 57033297)
Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 cbc1215f
...@@ -622,7 +622,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg, ...@@ -622,7 +622,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
* The memory cgroup could have been offlined while the cache * The memory cgroup could have been offlined while the cache
* creation work was pending. * creation work was pending.
*/ */
if (memcg->kmem_state != KMEM_ONLINE || root_cache->memcg_params.dying) if (memcg->kmem_state != KMEM_ONLINE)
goto out_unlock; goto out_unlock;
idx = memcg_cache_id(memcg); idx = memcg_cache_id(memcg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册