mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
	Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Stephane Eranian <eranian@google.com>,
	"robert.richter" <robert.richter@amd.com>,
	Andreas Herrmann <andreas.herrmann3@amd.com>,
	Borislav Petkov <bp@amd64.org>
Subject: Re: [PATCH] Perf, AMD: Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb()
Date: Mon, 01 Nov 2010 18:55:13 +0100	[thread overview]
Message-ID: <1288634113.2039.20.camel@laptop> (raw)
In-Reply-To: <alpine.LNX.2.00.1010302101240.1572@swampdragon.chaosbits.net>

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;
 
 	/*


  reply	other threads:[~2010-11-01 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-30 19:06 Jesper Juhl
2010-11-01 17:55 ` Peter Zijlstra [this message]
2010-11-01 17:57   ` Jesper Juhl
2010-11-02 14:08     ` Stephane Eranian

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=1288634113.2039.20.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=bp@amd64.org \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=robert.richter@amd.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®