[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-502568d563bcc37ac505a83341c0c95b88c015a8@git.kernel.org>
Date: Fri, 29 Jan 2010 09:27:02 GMT
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perf/core] perf_event: x86: Allocate the fake_cpuc
Commit-ID: 502568d563bcc37ac505a83341c0c95b88c015a8
Gitweb: http://git.kernel.org/tip/502568d563bcc37ac505a83341c0c95b88c015a8
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Fri, 22 Jan 2010 14:35:46 +0100
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 29 Jan 2010 09:01:35 +0100
perf_event: x86: Allocate the fake_cpuc
GCC was complaining the stack usage was too large, so allocate the
structure.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Stephane Eranian <eranian@...gle.com>
LKML-Reference: <20100122155535.411197266@...llo.nl>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
arch/x86/kernel/cpu/perf_event.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 0bd23d0..7bd359a 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2606,10 +2606,13 @@ static const struct pmu pmu = {
static int validate_group(struct perf_event *event)
{
struct perf_event *leader = event->group_leader;
- struct cpu_hw_events fake_cpuc;
- int n;
+ struct cpu_hw_events *fake_cpuc;
+ int ret, n;
- memset(&fake_cpuc, 0, sizeof(fake_cpuc));
+ ret = -ENOMEM;
+ fake_cpuc = kmalloc(sizeof(*fake_cpuc), GFP_KERNEL | __GFP_ZERO);
+ if (!fake_cpuc)
+ goto out;
/*
* the event is not yet connected with its
@@ -2617,18 +2620,24 @@ static int validate_group(struct perf_event *event)
* existing siblings, then add the new event
* before we can simulate the scheduling
*/
- n = collect_events(&fake_cpuc, leader, true);
+ ret = -ENOSPC;
+ n = collect_events(fake_cpuc, leader, true);
if (n < 0)
- return -ENOSPC;
+ goto out_free;
- fake_cpuc.n_events = n;
- n = collect_events(&fake_cpuc, event, false);
+ fake_cpuc->n_events = n;
+ n = collect_events(fake_cpuc, event, false);
if (n < 0)
- return -ENOSPC;
+ goto out_free;
- fake_cpuc.n_events = n;
+ fake_cpuc->n_events = n;
- return x86_schedule_events(&fake_cpuc, n, NULL);
+ ret = x86_schedule_events(fake_cpuc, n, NULL);
+
+out_free:
+ kfree(fake_cpuc);
+out:
+ return ret;
}
const struct pmu *hw_perf_event_init(struct perf_event *event)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists