History

Merge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull minor tracing updates and fixes from Steven Rostedt: "It seems that one of my old pull requests have slipped through. The changes are contained to just the files that I maintain, and are changes from others that I told I would get into this merge window. They have already been in linux-next for several weeks, and should be well tested." * 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Remove unnecessary WARN_ONCE's from tracing_buffers_splice_read tracing: Remove unneeded checks from the stack tracer tracing: Add a resize function to make one buffer equivalent to another buffer

Linus Torvalds committed 13 years ago

Commit 758338e2 parents 224394a bf3071f2 files · +31 −33Browse files

Unified · Split

2 files
  1. kernel/trace/trace.c +31 −29
  2. kernel/trace/trace_stack.c +0 −4
kernel/trace/trace.c+31−29
@@ -3034,6 +3034,31 @@ static void set_buffer_entries(struct trace_array *tr, unsigned long val) · 3033 unmodified lines
30343034 tr->data[cpu]->entries = val;
30353035 }
30363036
3037+/* resize @tr's buffer to the size of @size_tr's entries */
3038+static int resize_buffer_duplicate_size(struct trace_array *tr,
3039+ struct trace_array *size_tr, int cpu_id)
3040+{
3041+ int cpu, ret = 0;
3042+
3043+ if (cpu_id == RING_BUFFER_ALL_CPUS) {
3044+ for_each_tracing_cpu(cpu) {
3045+ ret = ring_buffer_resize(tr->buffer,
3046+ size_tr->data[cpu]->entries, cpu);
3047+ if (ret < 0)
3048+ break;
3049+ tr->data[cpu]->entries = size_tr->data[cpu]->entries;
3050+ }
3051+ } else {
3052+ ret = ring_buffer_resize(tr->buffer,
3053+ size_tr->data[cpu_id]->entries, cpu_id);
3054+ if (ret == 0)
3055+ tr->data[cpu_id]->entries =
3056+ size_tr->data[cpu_id]->entries;
3057+ }
3058+
3059+ return ret;
3060+}
3061+
30373062 static int __tracing_resize_ring_buffer(unsigned long size, int cpu)
30383063 {
30393064 int ret;
@@ -3058,23 +3083,8 @@ static int __tracing_resize_ring_buffer(unsigned long size, int cpu) · 18 unmodified lines
30583083
30593084 ret = ring_buffer_resize(max_tr.buffer, size, cpu);
30603085 if (ret < 0) {
3061− int r = 0;
3062−
3063− if (cpu == RING_BUFFER_ALL_CPUS) {
3064− int i;
3065− for_each_tracing_cpu(i) {
3066− r = ring_buffer_resize(global_trace.buffer,
3067− global_trace.data[i]->entries,
3068− i);
3069− if (r < 0)
3070− break;
3071− }
3072− } else {
3073− r = ring_buffer_resize(global_trace.buffer,
3074− global_trace.data[cpu]->entries,
3075− cpu);
3076− }
3077−
3086+ int r = resize_buffer_duplicate_size(&global_trace,
3087+ &global_trace, cpu);
30783088 if (r < 0) {
30793089 /*
30803090 * AARGH! We are left with different
@@ -3212,17 +3222,11 @@ static int tracing_set_tracer(const char *buf) · 131 unmodified lines
32123222
32133223 topts = create_trace_option_files(t);
32143224 if (t->use_max_tr) {
3215− int cpu;
32163225 /* we need to make per cpu buffer sizes equivalent */
3217− for_each_tracing_cpu(cpu) {
3218− ret = ring_buffer_resize(max_tr.buffer,
3219− global_trace.data[cpu]->entries,
3220− cpu);
3221− if (ret < 0)
3222− goto out;
3223− max_tr.data[cpu]->entries =
3224− global_trace.data[cpu]->entries;
3225− }
3226+ ret = resize_buffer_duplicate_size(&max_tr, &global_trace,
3227+ RING_BUFFER_ALL_CPUS);
3228+ if (ret < 0)
3229+ goto out;
32263230 }
32273231
32283232 if (t->init) {
@@ -4271,13 +4275,11 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, · 1042 unmodified lines
42714275 return -ENOMEM;
42724276
42734277 if (*ppos & (PAGE_SIZE - 1)) {
4274− WARN_ONCE(1, "Ftrace: previous read must page-align\n");
42754278 ret = -EINVAL;
42764279 goto out;
42774280 }
42784281
42794282 if (len & (PAGE_SIZE - 1)) {
4280− WARN_ONCE(1, "Ftrace: splice_read should page-align\n");
42814283 if (len < PAGE_SIZE) {
42824284 ret = -EINVAL;
42834285 goto out;
kernel/trace/trace_stack.c+0−4
@@ -33,7 +33,6 @@ static unsigned long max_stack_size; · 32 unmodified lines
3333 static arch_spinlock_t max_stack_lock =
3434 (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
3535
36−static int stack_trace_disabled __read_mostly;
3736 static DEFINE_PER_CPU(int, trace_active);
3837 static DEFINE_MUTEX(stack_sysctl_mutex);
3938
@@ -116,9 +115,6 @@ stack_trace_call(unsigned long ip, unsigned long parent_ip, · 76 unmodified lines
116115 {
117116 int cpu;
118117
119− if (unlikely(!ftrace_enabled || stack_trace_disabled))
120− return;
121−
122118 preempt_disable_notrace();
123119
124120 cpu = raw_smp_processor_id();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t