mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Perf, AMD: Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb()
@ 2010-10-30 19:06 Jesper Juhl
  2010-11-01 17:55 ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2010-10-30 19:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Thomas Gleixner, H. Peter Anvin


Hi,

I believe this would be an improvement?

Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb().


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

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 46d5844..a3787b2 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -280,11 +280,10 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
 	struct amd_nb *nb;
 	int i;
 
-	nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
+	nb = kzalloc(sizeof(struct amd_nb), GFP_KERNEL);
 	if (!nb)
 		return NULL;
 
-	memset(nb, 0, sizeof(*nb));
 	nb->nb_id = nb_id;
 
 	/*


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


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

end of thread, other threads:[~2010-11-02 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-30 19:06 [PATCH] Perf, AMD: Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb() Jesper Juhl
2010-11-01 17:55 ` Peter Zijlstra
2010-11-01 17:57   ` Jesper Juhl
2010-11-02 14:08     ` Stephane Eranian

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

all inboxes | Powered by JetHome®