diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/Kconfig | 8 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 163fbfc2f39f..1ea0d1234f4a 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -62,6 +62,12 @@ config EVENT_TRACING | |||
62 | config CONTEXT_SWITCH_TRACER | 62 | config CONTEXT_SWITCH_TRACER |
63 | bool | 63 | bool |
64 | 64 | ||
65 | config RING_BUFFER_ALLOW_SWAP | ||
66 | bool | ||
67 | help | ||
68 | Allow the use of ring_buffer_swap_cpu. | ||
69 | Adds a very slight overhead to tracing when enabled. | ||
70 | |||
65 | # All tracer options should select GENERIC_TRACER. For those options that are | 71 | # All tracer options should select GENERIC_TRACER. For those options that are |
66 | # enabled by all tracers (context switch and event tracer) they select TRACING. | 72 | # enabled by all tracers (context switch and event tracer) they select TRACING. |
67 | # This allows those options to appear when no other tracer is selected. But the | 73 | # This allows those options to appear when no other tracer is selected. But the |
@@ -146,6 +152,7 @@ config IRQSOFF_TRACER | |||
146 | select TRACE_IRQFLAGS | 152 | select TRACE_IRQFLAGS |
147 | select GENERIC_TRACER | 153 | select GENERIC_TRACER |
148 | select TRACER_MAX_TRACE | 154 | select TRACER_MAX_TRACE |
155 | select RING_BUFFER_ALLOW_SWAP | ||
149 | help | 156 | help |
150 | This option measures the time spent in irqs-off critical | 157 | This option measures the time spent in irqs-off critical |
151 | sections, with microsecond accuracy. | 158 | sections, with microsecond accuracy. |
@@ -167,6 +174,7 @@ config PREEMPT_TRACER | |||
167 | depends on PREEMPT | 174 | depends on PREEMPT |
168 | select GENERIC_TRACER | 175 | select GENERIC_TRACER |
169 | select TRACER_MAX_TRACE | 176 | select TRACER_MAX_TRACE |
177 | select RING_BUFFER_ALLOW_SWAP | ||
170 | help | 178 | help |
171 | This option measures the time spent in preemption off critical | 179 | This option measures the time spent in preemption off critical |
172 | sections, with microsecond accuracy. | 180 | sections, with microsecond accuracy. |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 1766c0e8db5a..454e74e718cf 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -2084,6 +2084,7 @@ rb_reserve_next_event(struct ring_buffer *buffer, | |||
2084 | 2084 | ||
2085 | rb_start_commit(cpu_buffer); | 2085 | rb_start_commit(cpu_buffer); |
2086 | 2086 | ||
2087 | #ifdef CONFIG_RING_BUFFER_ALLOW_SWAP | ||
2087 | /* | 2088 | /* |
2088 | * Due to the ability to swap a cpu buffer from a buffer | 2089 | * Due to the ability to swap a cpu buffer from a buffer |
2089 | * it is possible it was swapped before we committed. | 2090 | * it is possible it was swapped before we committed. |
@@ -2096,6 +2097,7 @@ rb_reserve_next_event(struct ring_buffer *buffer, | |||
2096 | local_dec(&cpu_buffer->commits); | 2097 | local_dec(&cpu_buffer->commits); |
2097 | return NULL; | 2098 | return NULL; |
2098 | } | 2099 | } |
2100 | #endif | ||
2099 | 2101 | ||
2100 | length = rb_calculate_event_length(length); | 2102 | length = rb_calculate_event_length(length); |
2101 | again: | 2103 | again: |
@@ -3498,6 +3500,7 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu) | |||
3498 | } | 3500 | } |
3499 | EXPORT_SYMBOL_GPL(ring_buffer_empty_cpu); | 3501 | EXPORT_SYMBOL_GPL(ring_buffer_empty_cpu); |
3500 | 3502 | ||
3503 | #ifdef CONFIG_RING_BUFFER_ALLOW_SWAP | ||
3501 | /** | 3504 | /** |
3502 | * ring_buffer_swap_cpu - swap a CPU buffer between two ring buffers | 3505 | * ring_buffer_swap_cpu - swap a CPU buffer between two ring buffers |
3503 | * @buffer_a: One buffer to swap with | 3506 | * @buffer_a: One buffer to swap with |
@@ -3573,6 +3576,7 @@ out: | |||
3573 | return ret; | 3576 | return ret; |
3574 | } | 3577 | } |
3575 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); | 3578 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); |
3579 | #endif /* CONFIG_RING_BUFFER_ALLOW_SWAP */ | ||
3576 | 3580 | ||
3577 | /** | 3581 | /** |
3578 | * ring_buffer_alloc_read_page - allocate a page to read from buffer | 3582 | * ring_buffer_alloc_read_page - allocate a page to read from buffer |