Message ID | 20210223235128.Eey1x63a9%akpm@linux-foundation.org |
---|---|
State | Superseded |
Headers | show |
Series | + mm-memcontrol-fix-get_active_memcg-return-value.patch added to -mm tree | expand |
--- a/mm/memcontrol.c~mm-memcontrol-fix-get_active_memcg-return-value +++ a/mm/memcontrol.c @@ -1061,13 +1061,9 @@ static __always_inline struct mem_cgroup rcu_read_lock(); memcg = active_memcg(); - if (memcg) { - /* current->active_memcg must hold a ref. */ - if (WARN_ON_ONCE(!css_tryget(&memcg->css))) - memcg = root_mem_cgroup; - else - memcg = current->active_memcg; - } + /* remote memcg must hold a ref. */ + if (memcg && WARN_ON_ONCE(!css_tryget(&memcg->css))) + memcg = root_mem_cgroup; rcu_read_unlock(); return memcg;