Skip to content

Commit 034c6ef

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation
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 <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <[email protected]>
1 parent eed0152 commit 034c6ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kernel/cpu/perf_event_amd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
280280
struct amd_nb *nb;
281281
int i;
282282

283-
nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
283+
nb = kmalloc_node(sizeof(struct amd_nb), GFP_KERNEL | __GFP_ZERO,
284+
cpu_to_node(cpu));
284285
if (!nb)
285286
return NULL;
286287

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

290290
/*

0 commit comments

Comments
 (0)