Message ID | 20190611231813.3148843-7-guro@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm: reparent slab memory on cgroup removal | expand |
On Tue, Jun 11, 2019 at 04:18:09PM -0700, Roman Gushchin wrote: > 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. > > Signed-off-by: Roman Gushchin <guro@fb.com> Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
On Tue, Jun 11, 2019 at 4:18 PM Roman Gushchin <guro@fb.com> wrote: > > 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, Yes, it's the user's responsibility to synchronize the kmem cache destruction and allocations. > 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. > > Signed-off-by: Roman Gushchin <guro@fb.com> Reviewed-by: Shakeel Butt <shakeelb@google.com>
diff --git a/mm/slab_common.c b/mm/slab_common.c index 5e7638f495d1..9383104651cd 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -640,7 +640,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg, * The memory cgroup could have been offlined while the cache * creation work was pending. */ - if (memcg->kmem_state != KMEM_ONLINE || root_cache->memcg_params.dying) + if (memcg->kmem_state != KMEM_ONLINE) goto out_unlock; idx = memcg_cache_id(memcg);
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. Signed-off-by: Roman Gushchin <guro@fb.com> --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)