Message ID | 20210225191441.qO40JqBXH%akpm@linux-foundation.org |
---|---|
State | New |
Headers | show |
Series | [merged] mm-memcontrol-fix-get_active_memcg-return-value.patch removed from -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;