From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763681AbYDOB7e (ORCPT ); Mon, 14 Apr 2008 21:59:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759445AbYDOB71 (ORCPT ); Mon, 14 Apr 2008 21:59:27 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:52776 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1759417AbYDOB70 (ORCPT ); Mon, 14 Apr 2008 21:59:26 -0400 Message-ID: <48040B7D.4040708@cn.fujitsu.com> Date: Tue, 15 Apr 2008 09:57:17 +0800 From: Li Zefan User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: KAMEZAWA Hiroyuki CC: Andrew Morton , "balbir@linux.vnet.ibm.com" , "xemul@openvz.org" , menage@google.com, "linux-mm@kvack.org" , LKML Subject: Re: [PATCH] use vmalloc for mem_cgroup allocation. References: <20080415105434.3044afb6.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20080415105434.3044afb6.kamezawa.hiroyu@jp.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KAMEZAWA Hiroyuki wrote: > On ia64, kmalloc() in mem_cgroup_create requires order-4 pages. But this is not > necessary to be phisically contiguous. And we'll see page allocation failure. > (Note: x86-32, which has small vmalloc area, has small mem_cgroup struct.) > For here, vmalloc is better. > > > Signed-off-by: KAMEZAWA Hiroyuki > > Index: mm-2.6.25-rc8-mm2/mm/memcontrol.c > =================================================================== > --- mm-2.6.25-rc8-mm2.orig/mm/memcontrol.c > +++ mm-2.6.25-rc8-mm2/mm/memcontrol.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include > > @@ -993,7 +994,7 @@ mem_cgroup_create(struct cgroup_subsys * > mem = &init_mem_cgroup; > page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC); > } else > - mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL); > + mem = vmalloc(sizeof(struct mem_cgroup)); > memset(mem, 0, sizeof(*mem)); should we initialize it with 0? > if (mem == NULL) > return ERR_PTR(-ENOMEM); > @@ -1011,7 +1012,7 @@ free_out: > for_each_node_state(node, N_POSSIBLE) > free_mem_cgroup_per_zone_info(mem, node); > if (cont->parent != NULL) > - kfree(mem); > + vfree(mem); > return ERR_PTR(-ENOMEM); > } > > @@ -1031,7 +1032,7 @@ static void mem_cgroup_destroy(struct cg > for_each_node_state(node, N_POSSIBLE) > free_mem_cgroup_per_zone_info(mem, node); > > - kfree(mem_cgroup_from_cont(cont)); > + vfree(mem_cgroup_from_cont(cont)); > } > > static int mem_cgroup_populate(struct cgroup_subsys *ss, > > From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <48040B7D.4040708@cn.fujitsu.com> Date: Tue, 15 Apr 2008 09:57:17 +0800 From: Li Zefan MIME-Version: 1.0 Subject: Re: [PATCH] use vmalloc for mem_cgroup allocation. References: <20080415105434.3044afb6.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20080415105434.3044afb6.kamezawa.hiroyu@jp.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: KAMEZAWA Hiroyuki Cc: Andrew Morton , "balbir@linux.vnet.ibm.com" , "xemul@openvz.org" , menage@google.com, "linux-mm@kvack.org" , LKML List-ID: KAMEZAWA Hiroyuki wrote: > On ia64, kmalloc() in mem_cgroup_create requires order-4 pages. But this is not > necessary to be phisically contiguous. And we'll see page allocation failure. > (Note: x86-32, which has small vmalloc area, has small mem_cgroup struct.) > For here, vmalloc is better. > > > Signed-off-by: KAMEZAWA Hiroyuki > > Index: mm-2.6.25-rc8-mm2/mm/memcontrol.c > =================================================================== > --- mm-2.6.25-rc8-mm2.orig/mm/memcontrol.c > +++ mm-2.6.25-rc8-mm2/mm/memcontrol.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include > > @@ -993,7 +994,7 @@ mem_cgroup_create(struct cgroup_subsys * > mem = &init_mem_cgroup; > page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC); > } else > - mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL); > + mem = vmalloc(sizeof(struct mem_cgroup)); > memset(mem, 0, sizeof(*mem)); should we initialize it with 0? > if (mem == NULL) > return ERR_PTR(-ENOMEM); > @@ -1011,7 +1012,7 @@ free_out: > for_each_node_state(node, N_POSSIBLE) > free_mem_cgroup_per_zone_info(mem, node); > if (cont->parent != NULL) > - kfree(mem); > + vfree(mem); > return ERR_PTR(-ENOMEM); > } > > @@ -1031,7 +1032,7 @@ static void mem_cgroup_destroy(struct cg > for_each_node_state(node, N_POSSIBLE) > free_mem_cgroup_per_zone_info(mem, node); > > - kfree(mem_cgroup_from_cont(cont)); > + vfree(mem_cgroup_from_cont(cont)); > } > > static int mem_cgroup_populate(struct cgroup_subsys *ss, > > -- 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: email@kvack.org