Skip to content

Commit 6f42249

Browse files
committed
tracing: Limit trace_seq size to just 8K and not depend on architecture PAGE_SIZE
The trace_seq buffer is used to print out entire events. It's typically set to PAGE_SIZE * 2 as there's some events that can be quite large. As a side effect, writes to trace_marker is limited by both the size of the trace_seq buffer as well as the ring buffer's sub-buffer size (which is a power of PAGE_SIZE). By limiting the trace_seq size, it also limits the size of the largest string written to trace_marker. trace_seq does not need to be dependent on PAGE_SIZE like the ring buffer sub-buffers need to be. Hard code it to 8K which is PAGE_SIZE * 2 on most architectures. This will also limit the size of trace_marker on those architectures with greater than 4K PAGE_SIZE. Link: https://lore.kernel.org/all/20240302111244.3a1674be@gandalf.local.home/ Link: https://lore.kernel.org/linux-trace-kernel/20240304191342.56fb1087@gandalf.local.home Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Sachin Sant <sachinp@linux.ibm.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 5efd3e2 commit 6f42249

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/linux/trace_seq.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@
99
/*
1010
* Trace sequences are used to allow a function to call several other functions
1111
* to create a string of data to use.
12+
*
13+
* Have the trace seq to be 8K which is typically PAGE_SIZE * 2 on
14+
* most architectures. The TRACE_SEQ_BUFFER_SIZE (which is
15+
* TRACE_SEQ_SIZE minus the other fields of trace_seq), is the
16+
* max size the output of a trace event may be.
1217
*/
1318

14-
#define TRACE_SEQ_BUFFER_SIZE (PAGE_SIZE * 2 - \
19+
#define TRACE_SEQ_SIZE 8192
20+
#define TRACE_SEQ_BUFFER_SIZE (TRACE_SEQ_SIZE - \
1521
(sizeof(struct seq_buf) + sizeof(size_t) + sizeof(int)))
1622

1723
struct trace_seq {

0 commit comments

Comments
 (0)