linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH v2 09/22] libtracefs: Increase splice to use pipe max size
Date: Thu, 28 Dec 2023 16:52:04 -0500	[thread overview]
Message-ID: <20231228215433.54854-10-rostedt@goodmis.org> (raw)
In-Reply-To: <20231228215433.54854-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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@goodmis.org>
---
 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


  parent reply	other threads:[~2023-12-28 21:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 21:51 [PATCH v2 00/22] libtracefs: Several updates Steven Rostedt
2023-12-28 21:51 ` [PATCH v2 01/22] libtracefs Documentation: Fix tracefs_event_file_exists() issues Steven Rostedt
2023-12-28 21:51 ` [PATCH v2 02/22] libtracefs testing: Use one tep handle for most tests Steven Rostedt
2023-12-28 21:51 ` [PATCH v2 03/22] libtracefs: Free "missed_followers" of instance Steven Rostedt
2023-12-28 21:51 ` [PATCH v2 04/22] libtracefs: Free buf in clear_func_filter() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 05/22] libtracefs: Free tracing_dir in case of remount Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 06/22] libtracefs: Free dynamic event list in utest Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 07/22] libtracefs: Reset tracing before and after unit tests Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 08/22] libtracefs: Add API to remove followers from an instance or toplevel Steven Rostedt
2023-12-28 21:52 ` Steven Rostedt [this message]
2023-12-28 21:52 ` [PATCH v2 10/22] libtracefs: Add tracefs_instance_file_write_number() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 11/22] libtracefs: Add API to read tracefs_cpu and return a kbuffer Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 12/22] libtracefs: Add tracefs_instance_get/set_buffer_percent() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 13/22] libtracefs: Add tracefs_instance_clear() API Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 14/22] libtracefs utest: Add test to test tracefs_instance_set/get_buffer_percent() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 15/22] libtracefs: Add kerneldoc comments to tracefs_instance_set_buffer_size() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 16/22] libtracefs: Add tracefs_load_headers() API Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 17/22] libtracefs: Add API to extract ring buffer statistics Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 18/22] libtracefs: Add tracefs_instance_set/get_subbuf_size() Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 19/22] libtracefs: Add TIMESTAMP_USECS_DELTA to simplify SQL timestamp compares Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 20/22] libtracefs: Also clear max_graph_depth on reset Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 21/22] libtracefs: Add PID filtering API Steven Rostedt
2023-12-28 21:52 ` [PATCH v2 22/22] libtracefs: Add updating and reading snapshot buffers Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231228215433.54854-10-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).