Re: [PATCH] memcg: fix memcg_cache_name() to use cgroup_name()

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

 



On Wed 27-03-13 11:32:26, Johannes Weiner wrote:
> On Wed, Mar 27, 2013 at 04:11:04PM +0100, Michal Hocko wrote:
> > On Wed 27-03-13 10:58:25, Johannes Weiner wrote:
> > > On Wed, Mar 27, 2013 at 09:36:39AM +0100, Michal Hocko wrote:
> > [...]
> > > > +	/*
> > > > +	 * kmem_cache_create_memcg duplicates the given name and
> > > > +	 * cgroup_name for this name requires RCU context.
> > > > +	 * This static temporary buffer is used to prevent from
> > > > +	 * pointless shortliving allocation.
> > > > +	 */
> > > > +	if (!tmp_name) {
> > > > +		tmp_name = kmalloc(PAGE_SIZE, GFP_KERNEL);
> > > > +		WARN_ON_ONCE(!tmp_name);
> > > 
> > > Just use the page allocator directly and get a free allocation failure
> > > warning. 
> > 
> > WARN_ON_ONCE is probably pointless.
> > 
> > > Then again, order-0 pages are considered cheap enough that they never
> > > even fail in our current implementation.
> > > 
> > > Which brings me to my other point: why not just a simple single-page
> > > allocation?
> > 
> > No objection from me. I was previously thinking about the "proper"
> > size for something that is a file name. So I originally wanted to use
> > PATH_MAX instead but ended up with PAGE_SIZE for reasons I do not
> > remember now.  Maybe we can use NAME_MAX instead. I just do not like to
> > use page allocator directly when allocatating something like strings
> > etc...
> 
> Don't grep for GFP_TEMPORARY then, we do it in a couple places :-)

This is what Li suggested in the beginning and right, I didn't like it.

> NAME_MAX is just for single dentry names, not path names, no?  Might
> be a little short.

Yes, Glauber confirmed that MAX_PATH is needed.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  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]