public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/7] memcontrol: use simple_malloc()/simple_free()
@ 2008-11-16  4:33 Lai Jiangshan
  2008-11-16  4:51 ` Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: Lai Jiangshan @ 2008-11-16  4:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: kamezawa.hiroyu, Balbir Singh, Linux Kernel Mailing List


use simple_malloc()/simple_free() instead of current codes.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 866dcc7..66e1c6d 100644
--- 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);
 }
 
 




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-17  0:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-16  4:33 [PATCH 3/7] memcontrol: use simple_malloc()/simple_free() Lai Jiangshan
2008-11-16  4:51 ` Alexey Dobriyan
2008-11-16  4:54   ` Alexey Dobriyan
2008-11-17  0:09     ` KAMEZAWA Hiroyuki
2008-11-16  5:01   ` Lai Jiangshan
2008-11-16  8:16   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox