diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index c502b18594cc..fb3031cf9f17 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -5368,12 +5368,22 @@ int perf_event_init_task(struct task_struct *child) | |||
5368 | return ret; | 5368 | return ret; |
5369 | } | 5369 | } |
5370 | 5370 | ||
5371 | static void __init perf_event_init_all_cpus(void) | ||
5372 | { | ||
5373 | int cpu; | ||
5374 | struct perf_cpu_context *cpuctx; | ||
5375 | |||
5376 | for_each_possible_cpu(cpu) { | ||
5377 | cpuctx = &per_cpu(perf_cpu_context, cpu); | ||
5378 | __perf_event_init_context(&cpuctx->ctx, NULL); | ||
5379 | } | ||
5380 | } | ||
5381 | |||
5371 | static void __cpuinit perf_event_init_cpu(int cpu) | 5382 | static void __cpuinit perf_event_init_cpu(int cpu) |
5372 | { | 5383 | { |
5373 | struct perf_cpu_context *cpuctx; | 5384 | struct perf_cpu_context *cpuctx; |
5374 | 5385 | ||
5375 | cpuctx = &per_cpu(perf_cpu_context, cpu); | 5386 | cpuctx = &per_cpu(perf_cpu_context, cpu); |
5376 | __perf_event_init_context(&cpuctx->ctx, NULL); | ||
5377 | 5387 | ||
5378 | spin_lock(&perf_resource_lock); | 5388 | spin_lock(&perf_resource_lock); |
5379 | cpuctx->max_pertask = perf_max_events - perf_reserved_percpu; | 5389 | cpuctx->max_pertask = perf_max_events - perf_reserved_percpu; |
@@ -5439,6 +5449,7 @@ static struct notifier_block __cpuinitdata perf_cpu_nb = { | |||
5439 | 5449 | ||
5440 | void __init perf_event_init(void) | 5450 | void __init perf_event_init(void) |
5441 | { | 5451 | { |
5452 | perf_event_init_all_cpus(); | ||
5442 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, | 5453 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, |
5443 | (void *)(long)smp_processor_id()); | 5454 | (void *)(long)smp_processor_id()); |
5444 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, | 5455 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, |