diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4ac4d5edada4..08a8fac29f6a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3235,8 +3235,10 @@ int obj_cgroup_charge(struct obj_cgroup *objcg, gfp_t gfp, size_t size) * independently later. */ rcu_read_lock(); +retry: memcg = obj_cgroup_memcg(objcg); - css_get(&memcg->css); + if (unlikely(!css_tryget(&memcg->css))) + goto retry; rcu_read_unlock(); nr_pages = size >> PAGE_SHIFT;