* [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
@ 2013-06-25 8:15 zhangwei(Jovi)
2013-06-25 10:10 ` Masami Hiramatsu
0 siblings, 1 reply; 6+ messages in thread
From: zhangwei(Jovi) @ 2013-06-25 8:15 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Oleg Nesterov
Cc: Frederic Weisbecker, Srikar Dronamraju, Ingo Molnar, linux-kernel
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.
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:
--
1.7.9.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
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)
2013-06-25 13:31 ` Steven Rostedt
0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2013-06-25 10:10 UTC (permalink / raw)
To: zhangwei(Jovi)
Cc: Steven Rostedt, Oleg Nesterov, Frederic Weisbecker,
Srikar Dronamraju, Ingo Molnar, linux-kernel, yrl.pp-manager.tt
(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,
>
> 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:
>
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
2013-06-25 10:10 ` Masami Hiramatsu
@ 2013-06-25 10:37 ` zhangwei(Jovi)
2013-06-25 13:34 ` Steven Rostedt
2013-06-25 13:31 ` Steven Rostedt
1 sibling, 1 reply; 6+ messages in thread
From: zhangwei(Jovi) @ 2013-06-25 10:37 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Steven Rostedt, Oleg Nesterov, Frederic Weisbecker,
Srikar Dronamraju, Ingo Molnar, linux-kernel, yrl.pp-manager.tt
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:
>>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
2013-06-25 10:10 ` Masami Hiramatsu
2013-06-25 10:37 ` zhangwei(Jovi)
@ 2013-06-25 13:31 ` Steven Rostedt
1 sibling, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2013-06-25 13:31 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: zhangwei(Jovi),
Oleg Nesterov, Frederic Weisbecker, Srikar Dronamraju,
Ingo Molnar, linux-kernel, yrl.pp-manager.tt
On Tue, 2013-06-25 at 19:10 +0900, 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.
I totally agree with Masami here. Please do not add "side effects" to
the unregister function.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
2013-06-25 10:37 ` zhangwei(Jovi)
@ 2013-06-25 13:34 ` Steven Rostedt
2013-06-25 14:48 ` Jovi Zhang
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2013-06-25 13:34 UTC (permalink / raw)
To: zhangwei(Jovi)
Cc: Masami Hiramatsu, Oleg Nesterov, Frederic Weisbecker,
Srikar Dronamraju, Ingo Molnar, linux-kernel, yrl.pp-manager.tt
On Tue, 2013-06-25 at 18:37 +0800, zhangwei(Jovi) wrote:
> 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.
>
Is there a place that trace_kprobe.c frees the tp structure in
unregister?
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing/kprobes: move free_trace_probe into unregister_trace_probe
2013-06-25 13:34 ` Steven Rostedt
@ 2013-06-25 14:48 ` Jovi Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Jovi Zhang @ 2013-06-25 14:48 UTC (permalink / raw)
To: Steven Rostedt
Cc: zhangwei(Jovi),
Masami Hiramatsu, Oleg Nesterov, Frederic Weisbecker,
Srikar Dronamraju, Ingo Molnar, linux-kernel, yrl.pp-manager.tt
On Tue, Jun 25, 2013 at 9:34 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 2013-06-25 at 18:37 +0800, zhangwei(Jovi) wrote:
>> 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.
>>
>
> Is there a place that trace_kprobe.c frees the tp structure in
> unregister?
>
I won't argue put the free operation into unregister function in
trace_kprobe.c, as I said, one minor problem is the code
pattern between trace_kprobe.c and trace_uprobe.c is so
similar on unregister, but with little inconsistent, maybe
we can unify those code in trace_probe.c someday.
Anyway, this is not big functionality issue, free to leave in there
if authors don't argue.
jovi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-25 14:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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)
2013-06-25 13:34 ` Steven Rostedt
2013-06-25 14:48 ` Jovi Zhang
2013-06-25 13:31 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).