From patchwork Thu Dec 28 20:35:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13506194 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9439C10799 for ; Thu, 28 Dec 2023 20:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10DF4C43397; Thu, 28 Dec 2023 20:36:26 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rIx7z-00000000Dt6-39xz; Thu, 28 Dec 2023 15:37:15 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Cc: "Steven Rostedt (Google)" Subject: [PATCH 09/23] libtracefs: Increase splice to use pipe max size Date: Thu, 28 Dec 2023 15:35:31 -0500 Message-ID: <20231228203714.53294-10-rostedt@goodmis.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231228203714.53294-1-rostedt@goodmis.org> References: <20231228203714.53294-1-rostedt@goodmis.org> Precedence: bulk X-Mailing-List: linux-trace-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Steven Rostedt (Google)" 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) --- 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