[PATCH 09/23] libtracefs: Increase splice to use pipe max size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 src/tracefs-record.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index b078c8615194..8750fe7e0e29 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
-- 
2.42.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux