aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-12-28 16:52:04 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-12-28 19:17:54 -0500
commite34cbd83f6d3c63cd0194aae45b206049c42cb54 (patch)
treed3d856a4160b22b2492444383a3eaee1429d23f4
parent1f50965bff79554400e74372983d93af1105971a (diff)
downloadlibtracefs-e34cbd83f6d3c63cd0194aae45b206049c42cb54.tar.gz
libtracefs: Increase splice to use pipe max size
When a pipe is created for splicing to read the tracing ring buffer, instead of using the default size, which is usually around 65K, read /proc/sys/fs/pipe_max_size and try to set the pipe to use that size instead. Link: https://lore.kernel.org/linux-trace-devel/20231228215433.54854-10-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--src/tracefs-record.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index b078c86..8750fe7 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -319,6 +319,7 @@ int tracefs_cpu_read(struct tracefs_cpu *tcpu, void *buffer, bool nonblock)
static int init_splice(struct tracefs_cpu *tcpu)
{
+ char *buf;
int ret;
if (tcpu->splice_pipe[0] >= 0)
@@ -328,6 +329,12 @@ static int init_splice(struct tracefs_cpu *tcpu)
if (ret < 0)
return ret;
+ if (str_read_file("/proc/sys/fs/pipe-max-size", &buf, false)) {
+ int size = atoi(buf);
+ fcntl(tcpu->splice_pipe[0], F_SETPIPE_SZ, &size);
+ free(buf);
+ }
+
ret = fcntl(tcpu->splice_pipe[0], F_GETPIPE_SZ, &tcpu->pipe_size);
/*
* F_GETPIPE_SZ was introduced in 2.6.35, ftrace was introduced