From: tip-bot for Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, peterz@infradead.org,
xiaoguangrong@cn.fujitsu.com, fweisbec@gmail.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/urgent] perf_event: Clean up __perf_event_init_context()
Date: Wed, 9 Dec 2009 09:52:11 GMT [thread overview]
Message-ID: <tip-aa5452d70c0d559310598b243b8b1033c10056e7@git.kernel.org> (raw)
In-Reply-To: <4B1F194D.7080306@cn.fujitsu.com>
Commit-ID: aa5452d70c0d559310598b243b8b1033c10056e7
Gitweb: http://git.kernel.org/tip/aa5452d70c0d559310598b243b8b1033c10056e7
Author: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Wed, 9 Dec 2009 11:28:13 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 09:56:27 +0100
perf_event: Clean up __perf_event_init_context()
Clean up the code a bit:
- define 'perf_cpu_context' variable with 'static'
- use kzalloc() instead of kmalloc() and memset()
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4B1F194D.7080306@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/perf_event.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 3b0cf86..2b06c45 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -36,7 +36,7 @@
/*
* Each CPU has a list of per CPU events:
*/
-DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context);
+static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context);
int perf_max_events __read_mostly = 1;
static int perf_reserved_percpu __read_mostly;
@@ -1579,7 +1579,6 @@ static void
__perf_event_init_context(struct perf_event_context *ctx,
struct task_struct *task)
{
- memset(ctx, 0, sizeof(*ctx));
spin_lock_init(&ctx->lock);
mutex_init(&ctx->mutex);
INIT_LIST_HEAD(&ctx->group_list);
@@ -1654,7 +1653,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
}
if (!ctx) {
- ctx = kmalloc(sizeof(struct perf_event_context), GFP_KERNEL);
+ ctx = kzalloc(sizeof(struct perf_event_context), GFP_KERNEL);
err = -ENOMEM;
if (!ctx)
goto errout;
@@ -5105,7 +5104,7 @@ int perf_event_init_task(struct task_struct *child)
* First allocate and initialize a context for the child.
*/
- child_ctx = kmalloc(sizeof(struct perf_event_context), GFP_KERNEL);
+ child_ctx = kzalloc(sizeof(struct perf_event_context), GFP_KERNEL);
if (!child_ctx)
return -ENOMEM;
prev parent reply other threads:[~2009-12-09 9:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 3:28 [PATCH 1/3] perf_event: cleanup for __perf_event_init_context() Xiao Guangrong
2009-12-09 3:29 ` [PATCH 2/3] perf_event: allocate children's perf_event_ctxp at the right time Xiao Guangrong
2009-12-09 3:30 ` [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update() Xiao Guangrong
2009-12-09 8:54 ` Frederic Weisbecker
2009-12-09 9:52 ` [tip:perf/urgent] perf_event: Cleanup " tip-bot for Xiao Guangrong
2009-12-09 8:43 ` [PATCH 2/3] perf_event: allocate children's perf_event_ctxp at the right time Frederic Weisbecker
2009-12-09 9:52 ` [tip:perf/urgent] perf_event: Allocate " tip-bot for Xiao Guangrong
2009-12-09 8:33 ` [PATCH 1/3] perf_event: cleanup for __perf_event_init_context() Frederic Weisbecker
2009-12-09 9:52 ` tip-bot for Xiao Guangrong [this message]
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=tip-aa5452d70c0d559310598b243b8b1033c10056e7@git.kernel.org \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--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
Powered by JetHome