From: Frederic Weisbecker <fweisbec@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Stephane Eranian <eranian@google.com>
Subject: [RFC PATCH 6/6] perf: Humanize the number of contexts
Date: Mon, 16 Aug 2010 22:48:35 +0200 [thread overview]
Message-ID: <1281991715-10367-7-git-send-regression-fweisbec@gmail.com> (raw)
In-Reply-To: <1281991715-10367-1-git-send-regression-fweisbec@gmail.com>
Instead of hardcoding the number of contexts for the recursions
barriers, define a cpp constant to make the code more
self-explanatory.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
---
include/linux/perf_event.h | 14 ++++++++------
kernel/perf_event.c | 6 +++---
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d7e8ea6..ae6fa60 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -808,6 +808,12 @@ struct perf_event_context {
struct rcu_head rcu_head;
};
+/*
+ * Number of contexts where an event can trigger:
+ * task, softirq, hardirq, nmi.
+ */
+#define PERF_NR_CONTEXTS 4
+
/**
* struct perf_event_cpu_context - per cpu event context structure
*/
@@ -821,12 +827,8 @@ struct perf_cpu_context {
struct mutex hlist_mutex;
int hlist_refcount;
- /*
- * Recursion avoidance:
- *
- * task, softirq, irq, nmi context
- */
- int recursion[4];
+ /* Recursion avoidance in each contexts */
+ int recursion[PERF_NR_CONTEXTS];
};
struct perf_output_handle {
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 6ad61fb..e41e29b 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1767,7 +1767,7 @@ static u64 perf_event_read(struct perf_event *event)
* Callchain support
*/
-static DEFINE_PER_CPU(int, callchain_recursion[4]);
+static DEFINE_PER_CPU(int, callchain_recursion[PERF_NR_CONTEXTS]);
static atomic_t nr_callchain_events;
static DEFINE_MUTEX(callchain_mutex);
static struct perf_callchain_entry **callchain_cpu_entries;
@@ -1812,8 +1812,8 @@ static int alloc_callchain_buffers(void)
callchain_cpu_entries = entries;
for_each_possible_cpu(cpu) {
- entries[cpu] = kmalloc(sizeof(struct perf_callchain_entry) * 4,
- GFP_KERNEL);
+ entries[cpu] = kmalloc(sizeof(struct perf_callchain_entry) *
+ PERF_NR_CONTEXTS, GFP_KERNEL);
if (!entries[cpu])
return -ENOMEM;
}
--
1.6.2.3
next prev parent reply other threads:[~2010-08-16 20:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 20:48 [RFC PATCH 0/0 v3] callchain fixes and cleanups Frederic Weisbecker
2010-08-16 20:48 ` [RFC PATCH 1/6] perf: Drop unappropriate tests on arch callchains Frederic Weisbecker
2010-08-16 20:48 ` [RFC PATCH 2/6] perf: Generalize callchain_store() Frederic Weisbecker
2010-08-17 4:37 ` Paul Mackerras
2010-08-16 20:48 ` [RFC PATCH 3/6] perf: Generalize some arch callchain code Frederic Weisbecker
2010-08-17 3:46 ` Paul Mackerras
2010-08-18 3:51 ` Frederic Weisbecker
2010-08-16 20:48 ` [RFC PATCH 4/6] perf: Factorize callchain context handling Frederic Weisbecker
2010-08-17 4:37 ` Paul Mackerras
2010-08-16 20:48 ` [RFC PATCH 5/6] perf: Fix race in callchains Frederic Weisbecker
2010-08-17 1:34 ` [RFC PATCH 5/6 v4] " Frederic Weisbecker
2010-08-17 4:53 ` Paul Mackerras
2010-08-18 3:49 ` Frederic Weisbecker
2010-08-16 20:48 ` Frederic Weisbecker [this message]
2010-08-17 4:58 ` [RFC PATCH 0/0 v3] callchain fixes and cleanups Borislav Petkov
2010-08-18 3:53 ` Frederic Weisbecker
2010-08-17 10:32 ` Will Deacon
2010-08-18 3:55 ` Frederic Weisbecker
2010-08-18 9:08 ` Will Deacon
2010-08-18 16:15 ` Ingo Molnar
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=1281991715-10367-7-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/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