public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"yrl.pp-manager.tt@hitachi.com" <yrl.pp-manager.tt@hitachi.com>
Subject: Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
Date: Tue, 25 Jun 2013 18:37:57 +0800	[thread overview]
Message-ID: <51C97305.3090406@huawei.com> (raw)
In-Reply-To: <51C96C89.6080207@hitachi.com>

On 2013/6/25 18:10, Masami Hiramatsu wrote:
> (2013/06/25 17:15), zhangwei(Jovi) wrote:
>> There have no good reason to call free_trace_probe
>> every time when unregister_trace_probe return 0.
>>
>> Move free_trace_probe into unregister_trace_probe,
>> make code simpler.
> 
> Sorry, nack. For the symmetrical coding reason, I don't like
> involving "free" and "alloc" into "unregister"/"register"
> functions. I think those should be just another actions.
> 
> Thank you,

That's fine, I just saw there have a little inconsistent between
trace_kprobe.c and trace_uprobe.c.

Please ignore this patch if you don't like. :)
Thanks.

> 
>>
>> Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
>> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> Cc: Oleg Nesterov <oleg@redhat.com>
>> ---
>>  kernel/trace/trace_kprobe.c |    5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
>> index 9f46e98..f193c38 100644
>> --- a/kernel/trace/trace_kprobe.c
>> +++ b/kernel/trace/trace_kprobe.c
>> @@ -401,6 +401,7 @@ static int unregister_trace_probe(struct trace_probe *tp)
>>  	__unregister_trace_probe(tp);
>>  	list_del(&tp->list);
>>  	unregister_probe_event(tp);
>> +	free_trace_probe(tp);
>>
>>  	return 0;
>>  }
>> @@ -419,7 +420,6 @@ static int register_trace_probe(struct trace_probe *tp)
>>  		ret = unregister_trace_probe(old_tp);
>>  		if (ret < 0)
>>  			goto end;
>> -		free_trace_probe(old_tp);
>>  	}
>>
>>  	/* Register new event */
>> @@ -550,8 +550,6 @@ static int create_trace_probe(int argc, char **argv)
>>  		}
>>  		/* delete an event */
>>  		ret = unregister_trace_probe(tp);
>> -		if (ret == 0)
>> -			free_trace_probe(tp);
>>  		mutex_unlock(&probe_lock);
>>  		return ret;
>>  	}
>> @@ -680,7 +678,6 @@ static int release_all_trace_probes(void)
>>  	while (!list_empty(&probe_list)) {
>>  		tp = list_entry(probe_list.next, struct trace_probe, list);
>>  		unregister_trace_probe(tp);
>> -		free_trace_probe(tp);
>>  	}
>>
>>  end:
>>
> 
> 



  reply	other threads:[~2013-06-25 10:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25  8:15 [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe zhangwei(Jovi)
2013-06-25 10:10 ` Masami Hiramatsu
2013-06-25 10:37   ` zhangwei(Jovi) [this message]
2013-06-25 13:34     ` Steven Rostedt
2013-06-25 14:48       ` Jovi Zhang
2013-06-25 13:31   ` 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=51C97305.3090406@huawei.com \
    --to=jovi.zhangwei@huawei.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.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