diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-01-22 08:35:46 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-29 03:01:35 -0500 |
commit | 502568d563bcc37ac505a83341c0c95b88c015a8 (patch) | |
tree | 089e62b1f073306fa92a29081c63b4d86ecf47da /arch | |
parent | 8113070d6639d2245c6c79afb8df42cedab30540 (diff) |
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@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100122155535.411197266@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | 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 0bd23d01af34..7bd359a57839 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 = { | |||
2606 | static int validate_group(struct perf_event *event) | 2606 | static int validate_group(struct perf_event *event) |
2607 | { | 2607 | { |
2608 | struct perf_event *leader = event->group_leader; | 2608 | struct perf_event *leader = event->group_leader; |
2609 | struct cpu_hw_events fake_cpuc; | 2609 | struct cpu_hw_events *fake_cpuc; |
2610 | int n; | 2610 | int ret, n; |
2611 | 2611 | ||
2612 | memset(&fake_cpuc, 0, sizeof(fake_cpuc)); | 2612 | ret = -ENOMEM; |
2613 | fake_cpuc = kmalloc(sizeof(*fake_cpuc), GFP_KERNEL | __GFP_ZERO); | ||
2614 | if (!fake_cpuc) | ||
2615 | goto out; | ||
2613 | 2616 | ||
2614 | /* | 2617 | /* |
2615 | * the event is not yet connected with its | 2618 | * the event is not yet connected with its |
@@ -2617,18 +2620,24 @@ static int validate_group(struct perf_event *event) | |||
2617 | * existing siblings, then add the new event | 2620 | * existing siblings, then add the new event |
2618 | * before we can simulate the scheduling | 2621 | * before we can simulate the scheduling |
2619 | */ | 2622 | */ |
2620 | n = collect_events(&fake_cpuc, leader, true); | 2623 | ret = -ENOSPC; |
2624 | n = collect_events(fake_cpuc, leader, true); | ||
2621 | if (n < 0) | 2625 | if (n < 0) |
2622 | return -ENOSPC; | 2626 | goto out_free; |
2623 | 2627 | ||
2624 | fake_cpuc.n_events = n; | 2628 | fake_cpuc->n_events = n; |
2625 | n = collect_events(&fake_cpuc, event, false); | 2629 | n = collect_events(fake_cpuc, event, false); |
2626 | if (n < 0) | 2630 | if (n < 0) |
2627 | return -ENOSPC; | 2631 | goto out_free; |
2628 | 2632 | ||
2629 | fake_cpuc.n_events = n; | 2633 | fake_cpuc->n_events = n; |
2630 | 2634 | ||
2631 | return x86_schedule_events(&fake_cpuc, n, NULL); | 2635 | ret = x86_schedule_events(fake_cpuc, n, NULL); |
2636 | |||
2637 | out_free: | ||
2638 | kfree(fake_cpuc); | ||
2639 | out: | ||
2640 | return ret; | ||
2632 | } | 2641 | } |
2633 | 2642 | ||
2634 | const struct pmu *hw_perf_event_init(struct perf_event *event) | 2643 | const struct pmu *hw_perf_event_init(struct perf_event *event) |