Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1454181 > unrolled thread

Re: [PATCH 3/3] mm: memcontrol: add sanity checks for memcg->id.ref on get/put

Started byMichal Hocko <mhocko@kernel.org>
First post2016-08-02 14:50 +0200
Last post2016-08-03 00:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 3/3] mm: memcontrol: add sanity checks for memcg->id.ref  on get/put Michal Hocko <mhocko@kernel.org> - 2016-08-02 14:50 +0200
    Re: [PATCH 3/3] mm: memcontrol: add sanity checks for memcg->id.ref  on get/put Michal Hocko <mhocko@kernel.org> - 2016-08-03 00:00 +0200

#1454181 — Re: [PATCH 3/3] mm: memcontrol: add sanity checks for memcg->id.ref on get/put

FromMichal Hocko <mhocko@kernel.org>
Date2016-08-02 14:50 +0200
SubjectRe: [PATCH 3/3] mm: memcontrol: add sanity checks for memcg->id.ref on get/put
Message-ID<s1HiX-4uK-61@gated-at.bofh.it>
On Mon 01-08-16 16:26:26, Vladimir Davydov wrote:
[...]
>  static struct mem_cgroup *mem_cgroup_id_get_active(struct mem_cgroup *memcg)
>  {
> -	while (!atomic_inc_not_zero(&memcg->id.ref))
> +	while (!atomic_inc_not_zero(&memcg->id.ref)) {
> +		VM_BUG_ON(mem_cgroup_is_root(memcg));
>  		memcg = parent_mem_cgroup(memcg);
> +	}

why is this BUG_ON ok? What if the root.use_hierarchy=true?

>  	return memcg;
>  }
-- 
Michal Hocko
SUSE Labs

[toc] | [next] | [standalone]


#1455494

FromMichal Hocko <mhocko@kernel.org>
Date2016-08-03 00:00 +0200
Message-ID<s1PTb-1PI-1@gated-at.bofh.it>
In reply to#1454181
On Tue 02-08-16 14:45:03, Michal Hocko wrote:
> On Mon 01-08-16 16:26:26, Vladimir Davydov wrote:
> [...]
> >  static struct mem_cgroup *mem_cgroup_id_get_active(struct mem_cgroup *memcg)
> >  {
> > -	while (!atomic_inc_not_zero(&memcg->id.ref))
> > +	while (!atomic_inc_not_zero(&memcg->id.ref)) {
> > +		VM_BUG_ON(mem_cgroup_is_root(memcg));
> >  		memcg = parent_mem_cgroup(memcg);
> > +	}
> 
> why is this BUG_ON ok? What if the root.use_hierarchy=true?

Scratch that. I got it. root will never get its count down to 0. Sorry
about the noise.
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web