Skip to content

Commit 6f5e357

Browse files
committed
Merge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core
2 parents bb27f55 + 895b67f commit 6f5e357

2 files changed

Lines changed: 17 additions & 29 deletions

File tree

‎kernel/trace/ring_buffer.c‎

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ struct ring_buffer_per_cpu {
473473
int nr_pages_to_update;
474474
struct list_head new_pages; /* new pages to add */
475475
struct work_struct update_pages_work;
476-
struct completion update_completion;
476+
struct completion update_done;
477477
};
478478

479479
struct ring_buffer {
@@ -1058,7 +1058,7 @@ rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu)
10581058
lockdep_set_class(&cpu_buffer->reader_lock, buffer->reader_lock_key);
10591059
cpu_buffer->lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
10601060
INIT_WORK(&cpu_buffer->update_pages_work, update_pages_handler);
1061-
init_completion(&cpu_buffer->update_completion);
1061+
init_completion(&cpu_buffer->update_done);
10621062

10631063
bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()),
10641064
GFP_KERNEL, cpu_to_node(cpu));
@@ -1461,7 +1461,7 @@ static void update_pages_handler(struct work_struct *work)
14611461
struct ring_buffer_per_cpu *cpu_buffer = container_of(work,
14621462
struct ring_buffer_per_cpu, update_pages_work);
14631463
rb_update_pages(cpu_buffer);
1464-
complete(&cpu_buffer->update_completion);
1464+
complete(&cpu_buffer->update_done);
14651465
}
14661466

14671467
/**
@@ -1534,39 +1534,29 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
15341534
get_online_cpus();
15351535
/*
15361536
* Fire off all the required work handlers
1537-
* Look out for offline CPUs
1538-
*/
1539-
for_each_buffer_cpu(buffer, cpu) {
1540-
cpu_buffer = buffer->buffers[cpu];
1541-
if (!cpu_buffer->nr_pages_to_update ||
1542-
!cpu_online(cpu))
1543-
continue;
1544-
1545-
schedule_work_on(cpu, &cpu_buffer->update_pages_work);
1546-
}
1547-
/*
1548-
* This loop is for the CPUs that are not online.
1549-
* We can't schedule anything on them, but it's not necessary
1537+
* We can't schedule on offline CPUs, but it's not necessary
15501538
* since we can change their buffer sizes without any race.
15511539
*/
15521540
for_each_buffer_cpu(buffer, cpu) {
15531541
cpu_buffer = buffer->buffers[cpu];
1554-
if (!cpu_buffer->nr_pages_to_update ||
1555-
cpu_online(cpu))
1542+
if (!cpu_buffer->nr_pages_to_update)
15561543
continue;
15571544

1558-
rb_update_pages(cpu_buffer);
1545+
if (cpu_online(cpu))
1546+
schedule_work_on(cpu,
1547+
&cpu_buffer->update_pages_work);
1548+
else
1549+
rb_update_pages(cpu_buffer);
15591550
}
15601551

15611552
/* wait for all the updates to complete */
15621553
for_each_buffer_cpu(buffer, cpu) {
15631554
cpu_buffer = buffer->buffers[cpu];
1564-
if (!cpu_buffer->nr_pages_to_update ||
1565-
!cpu_online(cpu))
1555+
if (!cpu_buffer->nr_pages_to_update)
15661556
continue;
15671557

1568-
wait_for_completion(&cpu_buffer->update_completion);
1569-
/* reset this value */
1558+
if (cpu_online(cpu))
1559+
wait_for_completion(&cpu_buffer->update_done);
15701560
cpu_buffer->nr_pages_to_update = 0;
15711561
}
15721562

@@ -1593,13 +1583,12 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
15931583
if (cpu_online(cpu_id)) {
15941584
schedule_work_on(cpu_id,
15951585
&cpu_buffer->update_pages_work);
1596-
wait_for_completion(&cpu_buffer->update_completion);
1586+
wait_for_completion(&cpu_buffer->update_done);
15971587
} else
15981588
rb_update_pages(cpu_buffer);
15991589

1600-
put_online_cpus();
1601-
/* reset this value */
16021590
cpu_buffer->nr_pages_to_update = 0;
1591+
put_online_cpus();
16031592
}
16041593

16051594
out:

‎kernel/trace/trace.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,6 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
763763
* Register a new plugin tracer.
764764
*/
765765
int register_tracer(struct tracer *type)
766-
__releases(kernel_lock)
767-
__acquires(kernel_lock)
768766
{
769767
struct tracer *t;
770768
int ret = 0;
@@ -5114,7 +5112,8 @@ __init static int tracer_alloc_buffers(void)
51145112
max_tr.data[i] = &per_cpu(max_tr_data, i);
51155113
}
51165114

5117-
set_buffer_entries(&global_trace, ring_buf_size);
5115+
set_buffer_entries(&global_trace,
5116+
ring_buffer_size(global_trace.buffer, 0));
51185117
#ifdef CONFIG_TRACER_MAX_TRACE
51195118
set_buffer_entries(&max_tr, 1);
51205119
#endif

0 commit comments

Comments
 (0)