[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130327153220.GL16579@dhcp22.suse.cz>
Date: Wed, 27 Mar 2013 16:32:20 +0100
From: Michal Hocko <mhocko@...e.cz>
To: Glauber Costa <glommer@...allels.com>
Cc: Johannes Weiner <hannes@...xchg.org>, Tejun Heo <tj@...nel.org>,
Li Zefan <lizefan@...wei.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memcg: fix memcg_cache_name() to use cgroup_name()
On Wed 27-03-13 19:19:58, Glauber Costa wrote:
> On 03/27/2013 07:11 PM, 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.
>
> theoretically, this is PATH_MAX + max cache name.
So do you prefer kmalloc(PATH_MAX) or the page allocator directly as
Johannes suggests? I agree tha kamlloc(PAGE_SIZE) looks weird.
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists