diff options
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ring_buffer.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index fc4da2d97f9b..c634868c2921 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -1301,7 +1301,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, | |||
1301 | * In that off case, we need to allocate for all possible cpus. | 1301 | * In that off case, we need to allocate for all possible cpus. |
1302 | */ | 1302 | */ |
1303 | #ifdef CONFIG_HOTPLUG_CPU | 1303 | #ifdef CONFIG_HOTPLUG_CPU |
1304 | get_online_cpus(); | 1304 | cpu_notifier_register_begin(); |
1305 | cpumask_copy(buffer->cpumask, cpu_online_mask); | 1305 | cpumask_copy(buffer->cpumask, cpu_online_mask); |
1306 | #else | 1306 | #else |
1307 | cpumask_copy(buffer->cpumask, cpu_possible_mask); | 1307 | cpumask_copy(buffer->cpumask, cpu_possible_mask); |
@@ -1324,10 +1324,10 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, | |||
1324 | #ifdef CONFIG_HOTPLUG_CPU | 1324 | #ifdef CONFIG_HOTPLUG_CPU |
1325 | buffer->cpu_notify.notifier_call = rb_cpu_notify; | 1325 | buffer->cpu_notify.notifier_call = rb_cpu_notify; |
1326 | buffer->cpu_notify.priority = 0; | 1326 | buffer->cpu_notify.priority = 0; |
1327 | register_cpu_notifier(&buffer->cpu_notify); | 1327 | __register_cpu_notifier(&buffer->cpu_notify); |
1328 | cpu_notifier_register_done(); | ||
1328 | #endif | 1329 | #endif |
1329 | 1330 | ||
1330 | put_online_cpus(); | ||
1331 | mutex_init(&buffer->mutex); | 1331 | mutex_init(&buffer->mutex); |
1332 | 1332 | ||
1333 | return buffer; | 1333 | return buffer; |
@@ -1341,7 +1341,9 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, | |||
1341 | 1341 | ||
1342 | fail_free_cpumask: | 1342 | fail_free_cpumask: |
1343 | free_cpumask_var(buffer->cpumask); | 1343 | free_cpumask_var(buffer->cpumask); |
1344 | put_online_cpus(); | 1344 | #ifdef CONFIG_HOTPLUG_CPU |
1345 | cpu_notifier_register_done(); | ||
1346 | #endif | ||
1345 | 1347 | ||
1346 | fail_free_buffer: | 1348 | fail_free_buffer: |
1347 | kfree(buffer); | 1349 | kfree(buffer); |
@@ -1358,16 +1360,17 @@ ring_buffer_free(struct ring_buffer *buffer) | |||
1358 | { | 1360 | { |
1359 | int cpu; | 1361 | int cpu; |
1360 | 1362 | ||
1361 | get_online_cpus(); | ||
1362 | |||
1363 | #ifdef CONFIG_HOTPLUG_CPU | 1363 | #ifdef CONFIG_HOTPLUG_CPU |
1364 | unregister_cpu_notifier(&buffer->cpu_notify); | 1364 | cpu_notifier_register_begin(); |
1365 | __unregister_cpu_notifier(&buffer->cpu_notify); | ||
1365 | #endif | 1366 | #endif |
1366 | 1367 | ||
1367 | for_each_buffer_cpu(buffer, cpu) | 1368 | for_each_buffer_cpu(buffer, cpu) |
1368 | rb_free_cpu_buffer(buffer->buffers[cpu]); | 1369 | rb_free_cpu_buffer(buffer->buffers[cpu]); |
1369 | 1370 | ||
1370 | put_online_cpus(); | 1371 | #ifdef CONFIG_HOTPLUG_CPU |
1372 | cpu_notifier_register_done(); | ||
1373 | #endif | ||
1371 | 1374 | ||
1372 | kfree(buffer->buffers); | 1375 | kfree(buffer->buffers); |
1373 | free_cpumask_var(buffer->cpumask); | 1376 | free_cpumask_var(buffer->cpumask); |