All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kamezawa.hiroyu@jp.fujitsu.com,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/7] memcontrol: use simple_malloc()/simple_free()
Date: Sun, 16 Nov 2008 12:33:46 +0800	[thread overview]
Message-ID: <491FA2AA.6060706@cn.fujitsu.com> (raw)


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);
 }
 
 




             reply	other threads:[~2008-11-16  4:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-16  4:33 Lai Jiangshan [this message]
2008-11-16  4:51 ` [PATCH 3/7] memcontrol: use simple_malloc()/simple_free() 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

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=491FA2AA.6060706@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.