mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ftrace: Do not copy old hash when resetting.
Date: Mon, 14 Jul 2014 08:21:17 -0400	[thread overview]
Message-ID: <20140714082117.1b274a3d@gandalf.local.home> (raw)
In-Reply-To: <1405311000-75943-1-git-send-email-wangnan0@huawei.com>

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;


  reply	other threads:[~2014-07-14 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14  4:10 Wang Nan
2014-07-14 12:21 ` Steven Rostedt [this message]
2014-07-18  4:44 ` Wang Nan
2014-07-18 12:04   ` 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=20140714082117.1b274a3d@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=wangnan0@huawei.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

all inboxes | Powered by JetHome®