Re: [PATCH] memcg: use ID in page_cgroup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 24 Aug 2010 10:54:05 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> On Tue, 24 Aug 2010 10:14:25 +0900
> Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> wrote:
> 
> > > > > @@ -723,6 +729,11 @@ static inline bool mem_cgroup_is_root(st
> > > > >  	return (mem == root_mem_cgroup);
> > > > >  }
> > > > >  
> > > > > +static inline bool mem_cgroup_is_rootid(unsigned short id)
> > > > > +{
> > > > > +	return (id == 1);
> > > > > +}
> > > > > +
> > > > It might be better to add
> > > > 
> > > > 	BUG_ON(newid->id != 1)
> > > > 
> > > > in cgroup.c::cgroup_init_idr().
> > > > 
> > > 
> > > Why ??
> > > 
> > Just to make sure that the root css has id==1. mem_cgroup_is_rootid() make
> > use of the fact.
> > I'm sorry if I miss something.
> > 
> 
> Hmm. The function allocating ID does
> 
> 4530 static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
> 4531 {
> ==
> 4546         spin_lock(&ss->id_lock);
> 4547         /* Don't use 0. allocates an ID of 1-65535 */
> 4548         error = idr_get_new_above(&ss->idr, newid, 1, &myid);
> 4549         spin_unlock(&ss->id_lock);
> ==
> 
> and allocates ID above "1", always.
> 
> Adding BUG_ON(newid->id != 1) will mean that we doubt the bitmap function and
> consider possibility that new->id == 0.
> 
> But, we're 100% sure that it never happens.
> 
> I don't think adding a comment is a right thing to do.
> 
Okey, I don't have strong requirement to add BUG_ON() anyway.

These patches looks good to me except for some minor points I've commented.

Thanks,
Daisuke Nishimura.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]