From: "Bang Li" <libang.li@antgroup.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mhiramat@kernel.org, mark.rutland@arm.com,
mathieu.desnoyers@efficios.com,
linux-trace-kernel@vger.kernel.org, libang.linux@gmail.com
Subject: Re: [PATCH] ftrace: Replace ftrace_disabled variable with ftrace_is_dead function
Date: Sat, 20 Apr 2024 11:50:29 +0800 [thread overview]
Message-ID: <0c43ff81-042c-4705-8a46-543c47e2c203@antgroup.com> (raw)
In-Reply-To: <20240419214054.688d624e@rorschach.local.home>
On 2024/4/20 9:40, Steven Rostedt wrote:
> On Fri, 19 Apr 2024 22:38:44 +0800
> "Bang Li" <libang.li@antgroup.com> wrote:
>
>> Use the existing function ftrace_is_dead to replace the variable to make
>> the code clearer.
>>
>> Signed-off-by: Bang Li <libang.li@antgroup.com>
>> ---
>> kernel/trace/ftrace.c | 46 +++++++++++++++++++++----------------------
>> 1 file changed, 23 insertions(+), 23 deletions(-)
>>
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index 50ca4d4f8840..4a08c79db677 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -2693,7 +2693,7 @@ void __weak ftrace_replace_code(int mod_flags)
>> int schedulable = mod_flags & FTRACE_MODIFY_MAY_SLEEP_FL;
>> int failed;
>>
>> - if (unlikely(ftrace_disabled))
>> + if (unlikely(ftrace_is_dead()))
>> return;
>>
>
> NACK!
>
> ftrace_is_dead() is only there to make the static variable
> "ftrace_disabled" available for code outside of ftrace.c. In ftrace.c,
> it is perfectly fine to use ftrace_disabled.
>
> -- Steve
Thank you for your explanation, let me understand this. How about
replacing ftrace_disabled with unlike(ftrace_disabled)?
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 50ca4d4f8840..76e0814723cb 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6767,7 +6767,7 @@ void ftrace_release_mod(struct module *mod)
mutex_lock(&ftrace_lock);
- if (ftrace_disabled)
+ if (unlikely(ftrace_disabled))
goto out_unlock;
list_for_each_entry_safe(mod_map, n, &ftrace_mod_maps, list) {
@@ -6830,7 +6830,7 @@ void ftrace_module_enable(struct module *mod)
mutex_lock(&ftrace_lock);
- if (ftrace_disabled)
+ if (unlikely(ftrace_disabled))
goto out_unlock;
/*
Thanks again for the review!
Bang
next prev parent reply other threads:[~2024-04-20 3:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 14:38 [PATCH] ftrace: Replace ftrace_disabled variable with ftrace_is_dead function Bang Li
2024-04-20 1:40 ` Steven Rostedt
2024-04-20 3:50 ` Bang Li [this message]
2024-04-28 4:17 ` 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=0c43ff81-042c-4705-8a46-543c47e2c203@antgroup.com \
--to=libang.li@antgroup.com \
--cc=libang.linux@gmail.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--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