linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: Avoid a memset by using vzalloc
@ 2010-10-30 21:35 Jesper Juhl
  2010-10-30 23:34 ` Minchan Kim
  2010-11-01 22:00 ` Paul Menage
  0 siblings, 2 replies; 14+ messages in thread
From: Jesper Juhl @ 2010-10-30 21:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, Paul Menage, Li Zefan, containers

Hi,

We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc().


Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
compile tested only.
 page_cgroup.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 5bffada..34970c7 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -450,11 +450,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 	length = ((max_pages/SC_PER_PAGE) + 1);
 	array_size = length * sizeof(void *);
 
-	array = vmalloc(array_size);
+	array = vzalloc(array_size);
 	if (!array)
 		goto nomem;
 
-	memset(array, 0, array_size);
 	ctrl = &swap_cgroup_ctrl[type];
 	mutex_lock(&swap_cgroup_mutex);
 	ctrl->length = length;

-- 
Jesper Juhl <jj@chaosbits.net>             http://www.chaosbits.net/
Plain text mails only, please      http://www.expita.com/nomime.html
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html

--
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>

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

end of thread, other threads:[~2010-11-05  3:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-30 21:35 [PATCH] cgroup: Avoid a memset by using vzalloc Jesper Juhl
2010-10-30 23:34 ` Minchan Kim
2010-10-31 17:33   ` Balbir Singh
2010-11-01  5:40     ` Jesper Juhl
2010-11-03 14:38       ` Christoph Lameter
2010-11-03 15:20         ` jovi zhang
2010-11-03 15:31           ` Christoph Lameter
2010-11-03 15:48           ` Joe Perches
2010-11-03 16:10             ` Christoph Lameter
2010-11-04 21:43               ` Jesper Juhl
2010-11-05  3:07               ` [PATCH 00/49] Use vzalloc not vmalloc/kmemset Joe Perches
2010-11-05  3:08                 ` [PATCH 44/49] mm: Use vzalloc Joe Perches
2010-11-03 16:37           ` [PATCH] cgroup: Avoid a memset by using vzalloc Américo Wang
2010-11-01 22:00 ` Paul Menage

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