From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Li Zefan <lizf@cn.fujitsu.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 2/2][RFC] [PATCH 2/2] tracing: Write directly into splice page for trace_pipe
Date: Tue, 08 Dec 2009 14:54:07 -0500 [thread overview]
Message-ID: <20091208195731.376084898@goodmis.org> (raw)
In-Reply-To: 20091208195405.653797300@goodmis.org
[-- Attachment #1: 0002-tracing-Write-directly-into-splice-page-for-trace_pi.patch --]
[-- Type: text/plain, Size: 2207 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Now that the trace_seq has a separate buffer space, we can use this
feature to write directly into the splice page, instead of writing
to the trace_seq buffer and then copying it. This has shown almost
a 4% improvement in reading trace_pipe via splice:
Average timing of reading 10megs from trace_pipe before patch:
real 0m1.619s
user 0m0.002s
sys 0m1.596s
After patch:
real 0m1.561s
user 0m0.002s
sys 0m1.535s
These were the average of five runs of reading 10megs.
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.c | 32 +++++---------------------------
1 files changed, 5 insertions(+), 27 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index df25c4f..0ee4e0e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -468,25 +468,6 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
return cnt;
}
-static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt)
-{
- int len;
- void *ret;
-
- if (s->len <= s->readpos)
- return -EBUSY;
-
- len = s->len - s->readpos;
- if (cnt > len)
- cnt = len;
- ret = memcpy(buf, s->buffer + s->readpos, cnt);
- if (!ret)
- return -EFAULT;
-
- s->readpos += cnt;
- return cnt;
-}
-
/*
* ftrace_max_lock is used to protect the swapping of buffers
* when taking a max snapshot. The buffers themselves are
@@ -3240,21 +3221,18 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
if (!pages[i])
break;
- rem = tracing_fill_pipe_page(rem, iter);
+ trace_seq_init(&iter->seq, page_address(pages[i]), PAGE_SIZE);
- /* Copy the data into the page, so we can start over. */
- ret = trace_seq_to_buffer(&iter->seq,
- page_address(pages[i]),
- iter->seq.len);
- if (ret < 0) {
+ rem = tracing_fill_pipe_page(rem, iter);
+ if (!iter->seq.len) {
__free_page(pages[i]);
break;
}
+
partial[i].offset = 0;
partial[i].len = iter->seq.len;
-
- trace_seq_reset(&iter->seq);
}
+ trace_seq_init(&iter->seq, &iter->buffer, FTRACE_SEQ_BUFSIZE);
trace_event_read_unlock();
mutex_unlock(&iter->mutex);
--
1.6.5
next prev parent reply other threads:[~2009-12-08 19:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-08 19:54 [PATCH 0/2][RFC] [RFC] tracing: separate out buffer from trace_seq Steven Rostedt
2009-12-08 19:54 ` [PATCH 1/2][RFC] [PATCH 1/2] tracing: Change trace_seq to use separate buffer Steven Rostedt
2009-12-08 19:54 ` Steven Rostedt [this message]
2009-12-09 9:44 ` [PATCH 0/2][RFC] [RFC] tracing: separate out buffer from trace_seq Lai Jiangshan
2009-12-09 16:26 ` 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=20091208195731.376084898@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.