From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"xemul@openvz.org" <xemul@openvz.org>,
menage@google.com, "linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] use vmalloc for mem_cgroup allocation. v2
Date: Mon, 14 Apr 2008 19:28:48 -0700 [thread overview]
Message-ID: <1208226528.11920.55.camel@brick> (raw)
In-Reply-To: <20080414192042.c50d8d58.akpm@linux-foundation.org>
On Mon, 2008-04-14 at 19:20 -0700, Andrew Morton wrote:
> On Tue, 15 Apr 2008 10:08:25 +0800 Li Zefan <lizf@cn.fujitsu.com> wrote:
>
> > > @@ -992,8 +993,10 @@ mem_cgroup_create(struct cgroup_subsys *
> > > if (unlikely((cont->parent) == NULL)) {
> > > mem = &init_mem_cgroup;
> > > page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
> > > - } else
> > > - mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
> > > + } else {
> > > + mem = vmalloc(sizeof(struct mem_cgroup));
> > > + memset(mem, 0, sizeof(*mem));
> >
> > what if mem == NULL. ;)
> >
> > > + }
> > >
> > > if (mem == NULL)
> > > return ERR_PTR(-ENOMEM);
> >
> > So we can move this NULL check to the above else branch, in the if brach,
> > mem won't be NULL.
>
> err, yes.
>
> So I have:
>
> if (unlikely((cont->parent) == NULL)) {
if (unlikely(cont->parent == NULL)) {
> mem = &init_mem_cgroup;
> page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
> } else {
> mem = vmalloc(sizeof(struct mem_cgroup));
> if (mem == NULL)
if (!mem)
> return ERR_PTR(-ENOMEM);
> memset(mem, 0, sizeof(*mem));
> }
>
Cheers,
Harvey
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-04-15 2:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-15 1:54 [PATCH] use vmalloc for mem_cgroup allocation KAMEZAWA Hiroyuki
2008-04-15 1:57 ` Li Zefan
2008-04-15 2:07 ` KAMEZAWA Hiroyuki
2008-04-15 2:10 ` [PATCH] use vmalloc for mem_cgroup allocation. v2 KAMEZAWA Hiroyuki
2008-04-15 2:08 ` Li Zefan
2008-04-15 2:20 ` Andrew Morton
2008-04-15 2:28 ` Harvey Harrison [this message]
2008-04-15 3:12 ` KAMEZAWA Hiroyuki
2008-04-15 2:17 ` Andrew Morton
2008-04-15 3:16 ` KAMEZAWA Hiroyuki
2008-04-15 3:14 ` Li Zefan
2008-04-15 3:22 ` KAMEZAWA Hiroyuki
2008-04-15 5:12 ` [PATCH] use vmalloc for mem_cgroup allocation. v3 KAMEZAWA Hiroyuki
2008-04-16 19:19 ` [PATCH] use vmalloc for mem_cgroup allocation Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1208226528.11920.55.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).