linux/kernel/trace
Steven Rostedt (Red Hat) 1e0d6714ac ring-buffer: Do not wake up a splice waiter when page is not full
When an application connects to the ring buffer via splice, it can only
read full pages. Splice does not work with partial pages. If there is
not enough data to fill a page, the splice command will either block
or return -EAGAIN (if set to nonblock).

Code was added where if the page is not full, to just sleep again.
The problem is, it will get woken up again on the next event. That
is, when something is written into the ring buffer, if there is a waiter
it will wake it up. The waiter would then check the buffer, see that
it still does not have enough data to fill a page and go back to sleep.
To make matters worse, when the waiter goes back to sleep, it could
cause another event, which would wake it back up again to see it
doesn't have enough data and sleep again. This produces a tremendous
overhead and fills the ring buffer with noise.

For example, recording sched_switch on an idle system for 10 seconds
produces 25,350,475 events!!!

Create another wait queue for those waiters wanting full pages.
When an event is written, it only wakes up waiters if there's a full
page of data. It does not wake up the waiter if the page is not yet
full.

After this change, recording sched_switch on an idle system for 10
seconds produces only 800 events. Getting rid of 25,349,675 useless
events (99.9969% of events!!), is something to take seriously.

Cc: stable@vger.kernel.org # 3.16+
Cc: Rabin Vincent <rabin@rab.in>
Fixes: e30f53aad2 "tracing: Do not busy wait in buffer splice"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-11 07:41:42 -05:00
..
blktrace.c Merge branch 'for-3.19/core' of git://git.kernel.dk/linux-block 2014-12-13 14:14:23 -08:00
ftrace.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
Kconfig tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST 2014-07-18 13:58:12 -04:00
Makefile tracing / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM 2014-12-13 02:23:30 +01:00
power-traces.c PM / tracing: remove deprecated power trace API 2013-01-26 00:39:12 +01:00
ring_buffer_benchmark.c trace: Use 64-bit timekeeping 2015-01-28 11:02:05 -05:00
ring_buffer.c ring-buffer: Do not wake up a splice waiter when page is not full 2015-02-11 07:41:42 -05:00
rpm-traces.c PM / Runtime: Introduce trace points for tracing rpm_* functions 2011-09-27 22:53:27 +02:00
trace_benchmark.c tracing: Only calculate stats of tracepoint benchmarks for 2^32 times 2014-06-06 00:41:38 -04:00
trace_benchmark.h tracing: Add tracepoint benchmark tracepoint 2014-05-29 22:49:54 -04:00
trace_branch.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_clock.c tracing: Fix wraparound problems in "uptime" trace clock 2014-07-21 09:56:12 -04:00
trace_entries.h tracing: Add trace_puts() for even faster trace_printk() tracing 2013-03-15 00:35:55 -04:00
trace_event_perf.c perf: Check permission only for parent tracepoint event 2014-07-28 10:01:38 +02:00
trace_events_filter_test.h tracing/filter: Add startup tests for events filter 2011-08-19 14:35:59 -04:00
trace_events_filter.c tracing: Allow NOT to filter AND and OR clauses 2014-12-03 10:00:27 -05:00
trace_events_trigger.c trace: Replace single-character seq_puts with seq_putc 2014-11-14 07:55:55 -05:00
trace_events.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_export.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_functions_graph.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_functions.c tracing/trivial: Fix typos and make an int into a bool 2014-11-20 10:05:36 -05:00
trace_irqsoff.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_kdb.c tracing: kdb: Fix kernel livelock with empty buffers 2014-11-13 21:27:25 -05:00
trace_kprobe.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_mmiotrace.c tracing: Do not check return values of trace_seq_p*() for mmio tracer 2014-11-19 15:25:44 -05:00
trace_nop.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_output.c tracing: Add array printing helper 2015-01-28 10:34:47 -05:00
trace_output.h tracing: Add trace_seq_has_overflowed() and trace_handle_return() 2014-11-19 15:25:39 -05:00
trace_printk.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_probe.c tracing/probes: Do not use return value of trace_seq_printf() 2014-11-19 15:25:44 -05:00
trace_probe.h kprobes, ftrace: Use NOKPROBE_SYMBOL macro in ftrace 2014-04-24 10:26:39 +02:00
trace_sched_switch.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_sched_wakeup.c tracing: Remove unneeded includes of debugfs.h and fs.h 2015-01-22 11:19:48 -05:00
trace_selftest_dynamic.c ftrace: Add self-tests for multiple function trace users 2011-05-18 19:24:51 -04:00
trace_selftest.c Seems that Peter Zijlstra added a new check that is making old 2014-10-12 07:28:55 -04:00
trace_seq.c tracing: Use trace_seq_used() and seq_buf_used() instead of len 2014-11-19 22:01:15 -05:00
trace_stack.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_stat.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace_stat.h tracing/stat: Add stat_release() callback 2009-07-10 12:14:05 +02:00
trace_syscalls.c As the merge window is still open, and this code was not as complex 2014-12-16 12:53:59 -08:00
trace_uprobe.c tracing: Use IS_ERR() check for return value of tracing_init_dentry() 2015-01-22 11:19:49 -05:00
trace.c tracing: Fix unmapping loop in tracing_mark_write 2015-02-09 18:47:09 -05:00
trace.h tracing: Make tracing_init_dentry_tr() static 2015-02-02 10:22:23 -05:00