From: Jesper Juhl <jj@chaosbits.net>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] Zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Date: Fri, 29 Oct 2010 23:58:39 +0200 (CEST) [thread overview]
Message-ID: <alpine.LNX.2.00.1010292354060.24561@swampdragon.chaosbits.net> (raw)
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>
next reply other threads:[~2010-10-29 22:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 21:58 Jesper Juhl [this message]
2010-10-30 13:58 ` [PATCH] percpu: zero " Tejun Heo
2010-10-30 15:55 ` Jesper Juhl
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=alpine.LNX.2.00.1010292354060.24561@swampdragon.chaosbits.net \
--to=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox