* [PATCH] ftrace: Do not copy old hash when resetting.
@ 2014-07-14 4:10 Wang Nan
2014-07-14 12:21 ` Steven Rostedt
2014-07-18 4:44 ` Wang Nan
0 siblings, 2 replies; 4+ messages in thread
From: Wang Nan @ 2014-07-14 4:10 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar; +Cc: linux-kernel
If we are going to reset hash, we don't need to duplicate old hash
and remove every entries right after allocation.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
---
kernel/trace/ftrace.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 5b372e3..52d6931 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
else
orig_hash = &ops->notrace_hash;
- hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
+ if (!reset)
+ hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
+ else
+ hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
+
if (!hash) {
ret = -ENOMEM;
goto out_regex_unlock;
}
- if (reset)
- ftrace_filter_reset(hash);
if (buf && !ftrace_match_records(hash, buf, len)) {
ret = -EINVAL;
goto out_regex_unlock;
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ftrace: Do not copy old hash when resetting.
2014-07-14 4:10 [PATCH] ftrace: Do not copy old hash when resetting Wang Nan
@ 2014-07-14 12:21 ` Steven Rostedt
2014-07-18 4:44 ` Wang Nan
1 sibling, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2014-07-14 12:21 UTC (permalink / raw)
To: Wang Nan; +Cc: Ingo Molnar, linux-kernel
On Mon, 14 Jul 2014 12:10:00 +0800
Wang Nan <wangnan0@huawei.com> wrote:
> If we are going to reset hash, we don't need to duplicate old hash
> and remove every entries right after allocation.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> ---
> kernel/trace/ftrace.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 5b372e3..52d6931 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
> else
> orig_hash = &ops->notrace_hash;
>
> - hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> + if (!reset)
> + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> + else
> + hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
I'm fine with this patch, but please swap the if statement above. I
prefer the if condition being positive if there's also an else
statement above. That is:
if (reset)
hash = alloc_ftrace_hash();
else
hash = alloc_and_copy_ftrace_hash();
-- Steve
> +
> if (!hash) {
> ret = -ENOMEM;
> goto out_regex_unlock;
> }
>
> - if (reset)
> - ftrace_filter_reset(hash);
> if (buf && !ftrace_match_records(hash, buf, len)) {
> ret = -EINVAL;
> goto out_regex_unlock;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ftrace: Do not copy old hash when resetting.
2014-07-14 4:10 [PATCH] ftrace: Do not copy old hash when resetting Wang Nan
2014-07-14 12:21 ` Steven Rostedt
@ 2014-07-18 4:44 ` Wang Nan
2014-07-18 12:04 ` Steven Rostedt
1 sibling, 1 reply; 4+ messages in thread
From: Wang Nan @ 2014-07-18 4:44 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar; +Cc: linux-kernel
Hi Steve,
What's your opinion on my v2 patch ( https://lkml.org/lkml/2014/7/14/839 )?
I have swapped if consitions following your suggestion.
On 2014/7/14 12:10, Wang Nan wrote:
> If we are going to reset hash, we don't need to duplicate old hash
> and remove every entries right after allocation.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> ---
> kernel/trace/ftrace.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 5b372e3..52d6931 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
> else
> orig_hash = &ops->notrace_hash;
>
> - hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> + if (!reset)
> + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> + else
> + hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
> +
> if (!hash) {
> ret = -ENOMEM;
> goto out_regex_unlock;
> }
>
> - if (reset)
> - ftrace_filter_reset(hash);
> if (buf && !ftrace_match_records(hash, buf, len)) {
> ret = -EINVAL;
> goto out_regex_unlock;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ftrace: Do not copy old hash when resetting.
2014-07-18 4:44 ` Wang Nan
@ 2014-07-18 12:04 ` Steven Rostedt
0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2014-07-18 12:04 UTC (permalink / raw)
To: Wang Nan; +Cc: Ingo Molnar, linux-kernel
On Fri, 18 Jul 2014 12:44:18 +0800
Wang Nan <wangnan0@huawei.com> wrote:
> Hi Steve,
>
> What's your opinion on my v2 patch ( https://lkml.org/lkml/2014/7/14/839 )?
>
> I have swapped if consitions following your suggestion.
>
Bah I didn't see it.
Damn Claws mail, I need to figure out why the f*ck it randomly marks
all my email as read. This has caused me to miss a few important emails
recently :-(
It looks fine, I've now marked it as todo that way I'll see it to pull
it in for 3.17. Thanks,
-- Steve
> On 2014/7/14 12:10, Wang Nan wrote:
> > If we are going to reset hash, we don't need to duplicate old hash
> > and remove every entries right after allocation.
> >
> > Signed-off-by: Wang Nan <wangnan0@huawei.com>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > ---
> > kernel/trace/ftrace.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 5b372e3..52d6931 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
> > else
> > orig_hash = &ops->notrace_hash;
> >
> > - hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> > + if (!reset)
> > + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
> > + else
> > + hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
> > +
> > if (!hash) {
> > ret = -ENOMEM;
> > goto out_regex_unlock;
> > }
> >
> > - if (reset)
> > - ftrace_filter_reset(hash);
> > if (buf && !ftrace_match_records(hash, buf, len)) {
> > ret = -EINVAL;
> > goto out_regex_unlock;
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-18 12:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 4:10 [PATCH] ftrace: Do not copy old hash when resetting Wang Nan
2014-07-14 12:21 ` Steven Rostedt
2014-07-18 4:44 ` Wang Nan
2014-07-18 12:04 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox