Commit 502568d5 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_event: x86: Allocate the fake_cpuc

GCC was complaining the stack usage was too large, so allocate the
structure.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100122155535.411197266@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8113070d
...@@ -2606,10 +2606,13 @@ static const struct pmu pmu = { ...@@ -2606,10 +2606,13 @@ static const struct pmu pmu = {
static int validate_group(struct perf_event *event) static int validate_group(struct perf_event *event)
{ {
struct perf_event *leader = event->group_leader; struct perf_event *leader = event->group_leader;
struct cpu_hw_events fake_cpuc; struct cpu_hw_events *fake_cpuc;
int n; 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 * the event is not yet connected with its
...@@ -2617,18 +2620,24 @@ static int validate_group(struct perf_event *event) ...@@ -2617,18 +2620,24 @@ static int validate_group(struct perf_event *event)
* existing siblings, then add the new event * existing siblings, then add the new event
* before we can simulate the scheduling * 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) if (n < 0)
return -ENOSPC; goto out_free;
fake_cpuc.n_events = n; fake_cpuc->n_events = n;
n = collect_events(&fake_cpuc, event, false); n = collect_events(fake_cpuc, event, false);
if (n < 0) 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) const struct pmu *hw_perf_event_init(struct perf_event *event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment