Re: [PATCH -v2] memcg: don't do cleanup manually if mem_cgroup_css_online() fails

Glauber Costa
2013-04-03T08:30:59Z

On 04/03/2013 12:18 PM, Michal Hocko wrote:
> Dang. You are right! Glauber, is there any reason why
> memcg_kmem_mark_dead checks only KMEM_ACCOUNTED_ACTIVE rather than
> KMEM_ACCOUNTED_MASK?
>
> This all is very confusing to say the least.
Yes, it is.

In kmemcg we need to differentiate between "active" and "activated"
states due to static branches management. This is only important in the
first activation, to make sure the static branches patching are
synchronized.

From this point on, the ACTIVE flag is the one we should be looking at.

Again, I fully agree it is complicated, but being that a property of the
static branches (we tried to fix it in the static branches itself but
without a lot of luck, since by their design they patch one site at a
time). I tried to overcome this by testing handcrafted errors and
documenting the states as well as I could.

But that not always work *that* well. Maybe we can use the results of
this discussion to document the tear down process a bit more?