mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: mingo@elte.hu, rostedt@goodmis.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing - support multiple pids in set_pid_ftrace file
Date: Tue, 15 Sep 2009 14:36:17 +0200	[thread overview]
Message-ID: <20090915123617.GA26284@jolsa.lab.eng.brq.redhat.com> (raw)
In-Reply-To: <4AAF60F7.6040107@cn.fujitsu.com>

On Tue, Sep 15, 2009 at 05:40:07PM +0800, Li Zefan wrote:
> jolsa@redhat.com wrote:
SNIP

> > +	list_for_each_entry_safe(fpid, safe, &ftrace_pids, list) {
> > +		struct pid *pid = fpid->pid;
> > +
> > +		clear_ftrace_pid_task(&pid);
> 
> Now we can change clear_ftrace_pid_task() to take struct pid *
> instead of struct pid**.
> 
changed

> > +
> > +		if (pid != ftrace_swapper_pid)
> > +			put_pid(pid);
> > +
> 
> clear_ftrace_pid_task() already called put_pid().
> 
oops, you're right.. missed that

> > +		list_del(&fpid->list);
> > +		kfree(fpid);
> > +	}
> > +
> > +	ftrace_update_pid_func();
> > +	ftrace_startup_enable(0);
> > +
> > +	mutex_unlock(&ftrace_lock);
> > +}
> > +
> ...
> >  static ssize_t
> >  ftrace_pid_write(struct file *filp, const char __user *ubuf,
> >  		   size_t cnt, loff_t *ppos)
> >  {
> > -	struct pid *pid;
> >  	char buf[64];
> >  	long val;
> >  	int ret;
> > @@ -2897,57 +3016,36 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
> >  
> >  	buf[cnt] = 0;
> >  
> > +	/*
> > +	 * Allow the "echo > set_ftrace_pid" to clean
> > +	 * the pids quietly.
> > +	 */
> > +	if (!*ppos && *buf == '\n' && cnt == 1)
> > +		return 1;
> > +
> 
> How about:
> 	strstrip(buf);
> 	if (strlen(buf) == 0)
> 		return 1;
> 
thats better, changed

> So "echo -n '' > set_ftrace_pid" works too.
> 
> >  	ret = strict_strtol(buf, 10, &val);
> >  	if (ret < 0)
> >  		return ret;
> >  
> 

I'll send out v2 shortly, thanks
jirka

      reply	other threads:[~2009-09-15 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15  8:59 jolsa
2009-09-15  9:40 ` Li Zefan
2009-09-15 12:36   ` Jiri Olsa [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=20090915123617.GA26284@jolsa.lab.eng.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®