* [PATCH] Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
@ 2010-10-29 21:58 Jesper Juhl
2010-10-30 13:58 ` [PATCH] percpu: zero " Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2010-10-29 21:58 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, linux-mm
Don't do vmalloc() + memset() when vzalloc() will do.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
percpu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index efe8168..8d75223 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -294,9 +294,7 @@ static void *pcpu_mem_alloc(size_t size)
if (size <= PAGE_SIZE)
return kzalloc(size, GFP_KERNEL);
else {
- void *ptr = vmalloc(size);
- if (ptr)
- memset(ptr, 0, size);
+ void *ptr = vzalloc(size);
return ptr;
}
}
--
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] 3+ messages in thread* [PATCH] percpu: zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
2010-10-29 21:58 [PATCH] Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc() Jesper Juhl
@ 2010-10-30 13:58 ` Tejun Heo
2010-10-30 15:55 ` Jesper Juhl
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2010-10-30 13:58 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, linux-mm
Don't do vmalloc() + memset() when vzalloc() will do.
tj: dropped unnecessary temp variable ptr.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Applied with slight modification. Thank you.
mm/percpu.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index efe8168..9e16d1c 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -293,12 +293,8 @@ static void *pcpu_mem_alloc(size_t size)
if (size <= PAGE_SIZE)
return kzalloc(size, GFP_KERNEL);
- else {
- void *ptr = vmalloc(size);
- if (ptr)
- memset(ptr, 0, size);
- return ptr;
- }
+ else
+ return vzalloc(size);
}
/**
--
1.7.1
--
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] 3+ messages in thread
end of thread, other threads:[~2010-10-30 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29 21:58 [PATCH] Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc() Jesper Juhl
2010-10-30 13:58 ` [PATCH] percpu: zero " Tejun Heo
2010-10-30 15:55 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox