lkml.org 
[lkml]   [2010]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] Perf, AMD: Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb()
From
Date
On Sat, 2010-10-30 at 21:06 +0200, Jesper Juhl wrote:
> 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>
> ---


I've changed it to..

---
Subject: perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Mon Nov 01 18:52:05 CET 2010

Jasper suggested we use the zeroing capability of the allocators
instead of calling memset ourselves. Add node affinity while we're at
it.

Reported-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
Index: linux-2.6/arch/x86/kernel/cpu/perf_event_amd.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/perf_event_amd.c
+++ linux-2.6/arch/x86/kernel/cpu/perf_event_amd.c
@@ -280,11 +280,10 @@ static struct amd_nb *amd_alloc_nb(int c
struct amd_nb *nb;
int i;

- nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
+ nb = kmalloc_node(sizeof(struct amd_nb), GFP_KERNEL | __GFP_ZERO, nb_id);
if (!nb)
return NULL;

- memset(nb, 0, sizeof(*nb));
nb->nb_id = nb_id;

/*


\
 
 \ /
  Last update: 2010-11-01 18:59    [W:1.672 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site