[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20081117090938.0cdb531e.kamezawa.hiroyu@jp.fujitsu.com>
Date: Mon, 17 Nov 2008 09:09:38 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Lai Jiangshan <laijs@...fujitsu.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/7] memcontrol: use simple_malloc()/simple_free()
On Sun, 16 Nov 2008 07:54:04 +0300
Alexey Dobriyan <adobriyan@...il.com> wrote:
> On Sun, Nov 16, 2008 at 07:51:28AM +0300, Alexey Dobriyan wrote:
> > On Sun, Nov 16, 2008 at 12:33:46PM +0800, Lai Jiangshan wrote:
> > > use simple_malloc()/simple_free() instead of current codes.
> >
> > struct mem_cgroup can't reach the size when kmalloc starts failing.
>
> Or it probably can with big NR_CPUS.
>
> struct mem_cgroup_stat {
> struct mem_cgroup_stat_cpu cpustat[NR_CPUS];
> };
It's now changed. see mmotm.
Thanks,
-Kame
>
> > > --- a/mm/memcontrol.c
> > > +++ b/mm/memcontrol.c
> > > @@ -1062,11 +1062,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
> > > {
> > > struct mem_cgroup *mem;
> > >
> > > - if (sizeof(*mem) < PAGE_SIZE)
> > > - mem = kmalloc(sizeof(*mem), GFP_KERNEL);
> > > - else
> > > - mem = vmalloc(sizeof(*mem));
> > > -
> > > + mem = simple_malloc(sizeof(*mem));
> > > if (mem)
> > > memset(mem, 0, sizeof(*mem));
> > > return mem;
> > > @@ -1074,10 +1070,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
> > >
> > > static void mem_cgroup_free(struct mem_cgroup *mem)
> > > {
> > > - if (sizeof(*mem) < PAGE_SIZE)
> > > - kfree(mem);
> > > - else
> > > - vfree(mem);
> > > + simple_free(mem);
> > > }
>
--
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