From: Steven Rostedt <rostedt@goodmis.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>,
linux-kernel@vger.kernel.org,
Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Ingo Molnar <mingo@redhat.com>,
yrl.pp-manager.tt@hitachi.com
Subject: Re: [PATCH ftrace/core V5] ftrace: Introduce saved_cmdlines_size file
Date: Mon, 9 Jun 2014 09:48:28 -0400 [thread overview]
Message-ID: <20140609094828.011b0eb8@gandalf.local.home> (raw)
In-Reply-To: <871tuycx3b.fsf@sejong.aot.lge.com>
On Mon, 09 Jun 2014 17:21:12 +0900
Namhyung Kim <namhyung@gmail.com> wrote:
> Hi Yoshihiro,
>
> Sorry for being late, but just wanna give you some (minor) feedbacks..
>
>
> On Thu, 05 Jun 2014 10:24:27 +0900, Yoshihiro YUNOMAE wrote:
> > +static int trace_create_savedcmd(void)
> > +{
> > + int ret;
> > +
> > + savedcmd = kmalloc(sizeof(struct saved_cmdlines_buffer), GFP_KERNEL);
>
> s/sizeof(struct saved_cmdlines_buffer)/sizeof(*savedcmd)/
>
>
> > + if (!savedcmd)
> > + return -ENOMEM;
> > +
> > + ret = allocate_cmdlines_buffer(SAVED_CMDLINES_DEFAULT, savedcmd);
> > + if (ret < 0) {
> > + kfree(savedcmd);
> > + savedcmd = NULL;
> > + return -ENOMEM;
> > + }
> > +
> > + return 0;
> > }
>
> [SNIP]
> > static ssize_t
> > +tracing_saved_cmdlines_size_read(struct file *filp, char __user *ubuf,
> > + size_t cnt, loff_t *ppos)
> > +{
> > + char buf[64];
> > + int r;
> > +
> > + arch_spin_lock(&trace_cmdline_lock);
> > + r = sprintf(buf, "%u\n", savedcmd->cmdline_num);
>
> In general, it's better to use scnprintf() instead.
>
>
> > + arch_spin_unlock(&trace_cmdline_lock);
> > +
> > + return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
> > +}
> > +
> > +static void free_saved_cmdlines_buffer(struct saved_cmdlines_buffer *s)
> > +{
> > + kfree(s->saved_cmdlines);
> > + kfree(s->map_cmdline_to_pid);
> > + kfree(s);
> > +}
> > +
> > +static int tracing_resize_saved_cmdlines(unsigned int val)
> > +{
> > + struct saved_cmdlines_buffer *s, *savedcmd_temp;
> > +
> > + s = kmalloc(sizeof(struct saved_cmdlines_buffer), GFP_KERNEL);
>
> s/sizeof(struct saved_cmdlines_buffer)/sizeof(*s)/
>
I already pushed this to Linus. He hasn't pulled yet, but if you want
to send a patch against my ftrace/core, I'll add that. These are minor
enough to get into the merge window still.
-- Steve
> Thanks,
> Namhyung
>
>
> > + if (!s)
> > + return -ENOMEM;
> > +
> > + if (allocate_cmdlines_buffer(val, s) < 0) {
> > + kfree(s);
> > + return -ENOMEM;
> > + }
> > +
> > + arch_spin_lock(&trace_cmdline_lock);
> > + savedcmd_temp = savedcmd;
> > + savedcmd = s;
> > + arch_spin_unlock(&trace_cmdline_lock);
> > + free_saved_cmdlines_buffer(savedcmd_temp);
> > +
> > + return 0;
> > +}
prev parent reply other threads:[~2014-06-09 13:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 1:24 [PATCH ftrace/core V5] ftrace: Introduce saved_cmdlines_size file Yoshihiro YUNOMAE
2014-06-09 8:21 ` Namhyung Kim
2014-06-09 13:48 ` Steven Rostedt [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=20140609094828.011b0eb8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=yoshihiro.yunomae.ez@hitachi.com \
--cc=yrl.pp-manager.tt@hitachi.com \
/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