From: Frederic Weisbecker <fweisbec@gmail.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/6] tracing: event_id_read() uses simple buffer instead of trace_seq
Date: Wed, 20 Jan 2010 19:04:29 +0100 [thread overview]
Message-ID: <20100120180428.GC5017@nowhere> (raw)
In-Reply-To: <4B556069.3060200@cn.fujitsu.com>
On Tue, Jan 19, 2010 at 03:34:01PM +0800, Lai Jiangshan wrote:
>
> It seems that struct trace_seq is too heavy for event_id_read().
> we use simple buffer instead of struct trace_seq.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 04d3f90..835b370 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -604,23 +604,16 @@ static ssize_t
> event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
> {
> struct ftrace_event_call *call = filp->private_data;
> - struct trace_seq *s;
> - int r;
> + char buf[20];
> + int len;
>
> if (*ppos)
> return 0;
>
> - s = kmalloc(sizeof(*s), GFP_KERNEL);
> - if (!s)
> - return -ENOMEM;
> + len = snprintf(buf, sizeof(buf), "%d\n", call->id);
> + len = simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
>
> - trace_seq_init(s);
> - trace_seq_printf(s, "%d\n", call->id);
> -
> - r = simple_read_from_buffer(ubuf, cnt, ppos,
> - s->buffer, s->len);
> - kfree(s);
> - return r;
> + return len;
> }
>
> static ssize_t
>
>
prev parent reply other threads:[~2010-01-20 18:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 7:34 [PATCH 2/6] tracing: event_id_read() uses simple buffer instead of trace_seq Lai Jiangshan
2010-01-20 18:04 ` Frederic Weisbecker [this message]
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=20100120180428.GC5017@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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 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.