linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kernel/trace: call helper function to check global_trace
@ 2015-09-22 13:43 Yaowei Bai
  2015-09-22 13:43 ` [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean Yaowei Bai
  2015-09-22 13:58 ` [PATCH 1/2] kernel/trace: call helper function to check global_trace Steven Rostedt
  0 siblings, 2 replies; 5+ messages in thread
From: Yaowei Bai @ 2015-09-22 13:43 UTC (permalink / raw)
  To: rostedt, mingo; +Cc: linux-kernel

Use helper function tracing_is_enabled() to check if global_trace
has been disabled.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 6e79408..b0bd322a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7111,7 +7111,7 @@ __init static int tracer_alloc_buffers(void)
 		goto out_free_savedcmd;
 	}
 
-	if (global_trace.buffer_disabled)
+	if (!tracing_is_enabled())
 		tracing_off();
 
 	if (trace_boot_clock) {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean
  2015-09-22 13:43 [PATCH 1/2] kernel/trace: call helper function to check global_trace Yaowei Bai
@ 2015-09-22 13:43 ` Yaowei Bai
  2015-09-22 13:59   ` Steven Rostedt
  2015-09-22 13:58 ` [PATCH 1/2] kernel/trace: call helper function to check global_trace Steven Rostedt
  1 sibling, 1 reply; 5+ messages in thread
From: Yaowei Bai @ 2015-09-22 13:43 UTC (permalink / raw)
  To: rostedt, mingo; +Cc: linux-kernel

This patch makes is_good_name return bool to improve readability
due to this particular function only using either one or zero as its
return value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 kernel/trace/trace_probe.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index b98dee9..f6398db 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -302,15 +302,15 @@ static nokprobe_inline void call_fetch(struct fetch_param *fprm,
 }
 
 /* Check the name is good for event/group/fields */
-static inline int is_good_name(const char *name)
+static inline bool is_good_name(const char *name)
 {
 	if (!isalpha(*name) && *name != '_')
-		return 0;
+		return false;
 	while (*++name != '\0') {
 		if (!isalpha(*name) && !isdigit(*name) && *name != '_')
-			return 0;
+			return false;
 	}
-	return 1;
+	return true;
 }
 
 static inline struct event_file_link *
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] kernel/trace: call helper function to check global_trace
  2015-09-22 13:43 [PATCH 1/2] kernel/trace: call helper function to check global_trace Yaowei Bai
  2015-09-22 13:43 ` [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean Yaowei Bai
@ 2015-09-22 13:58 ` Steven Rostedt
  2015-09-23 13:49   ` Yaowei Bai
  1 sibling, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2015-09-22 13:58 UTC (permalink / raw)
  To: Yaowei Bai; +Cc: mingo, linux-kernel

On Tue, 22 Sep 2015 21:43:12 +0800
Yaowei Bai <bywxiaobai@163.com> wrote:

> Use helper function tracing_is_enabled() to check if global_trace
> has been disabled.

Actually, I prefer not to.

> 
> No functional change.
> 
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
>  kernel/trace/trace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 6e79408..b0bd322a 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -7111,7 +7111,7 @@ __init static int tracer_alloc_buffers(void)
>  		goto out_free_savedcmd;
>  	}
>  
> -	if (global_trace.buffer_disabled)
> +	if (!tracing_is_enabled())

Yes, the above is functionally equivalent. But tracing_is_enabled() is
not a "helper function" but actually an external interface for other
parts of the tracing system.

The above code is the actual setup of the tracing infrastructure, that
is used to allocate the tracing buffers. They may now use the same
logic, but there's no guarantee that it will in the future.

-- Steve


>  		tracing_off();
>  
>  	if (trace_boot_clock) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean
  2015-09-22 13:43 ` [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean Yaowei Bai
@ 2015-09-22 13:59   ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2015-09-22 13:59 UTC (permalink / raw)
  To: Yaowei Bai; +Cc: mingo, linux-kernel

On Tue, 22 Sep 2015 21:43:13 +0800
Yaowei Bai <bywxiaobai@163.com> wrote:

> This patch makes is_good_name return bool to improve readability
> due to this particular function only using either one or zero as its
> return value.

This patch makes sense. I'll take it. Thanks!

-- Steve

> 
> No functional change.
> 
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
>  kernel/trace/trace_probe.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
> index b98dee9..f6398db 100644
> --- a/kernel/trace/trace_probe.h
> +++ b/kernel/trace/trace_probe.h
> @@ -302,15 +302,15 @@ static nokprobe_inline void call_fetch(struct fetch_param *fprm,
>  }
>  
>  /* Check the name is good for event/group/fields */
> -static inline int is_good_name(const char *name)
> +static inline bool is_good_name(const char *name)
>  {
>  	if (!isalpha(*name) && *name != '_')
> -		return 0;
> +		return false;
>  	while (*++name != '\0') {
>  		if (!isalpha(*name) && !isdigit(*name) && *name != '_')
> -			return 0;
> +			return false;
>  	}
> -	return 1;
> +	return true;
>  }
>  
>  static inline struct event_file_link *


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] kernel/trace: call helper function to check global_trace
  2015-09-22 13:58 ` [PATCH 1/2] kernel/trace: call helper function to check global_trace Steven Rostedt
@ 2015-09-23 13:49   ` Yaowei Bai
  0 siblings, 0 replies; 5+ messages in thread
From: Yaowei Bai @ 2015-09-23 13:49 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mingo, linux-kernel

On Tue, Sep 22, 2015 at 09:58:47AM -0400, Steven Rostedt wrote:
> On Tue, 22 Sep 2015 21:43:12 +0800
> Yaowei Bai <bywxiaobai@163.com> wrote:
> 
> > Use helper function tracing_is_enabled() to check if global_trace
> > has been disabled.
> 
> Actually, I prefer not to.
> 
> > 
> > No functional change.
> > 
> > Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> > ---
> >  kernel/trace/trace.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 6e79408..b0bd322a 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -7111,7 +7111,7 @@ __init static int tracer_alloc_buffers(void)
> >  		goto out_free_savedcmd;
> >  	}
> >  
> > -	if (global_trace.buffer_disabled)
> > +	if (!tracing_is_enabled())
> 
> Yes, the above is functionally equivalent. But tracing_is_enabled() is
> not a "helper function" but actually an external interface for other
> parts of the tracing system.

Got it.

> 
> The above code is the actual setup of the tracing infrastructure, that
> is used to allocate the tracing buffers. They may now use the same
> logic, but there's no guarantee that it will in the future.

Appreciate you wonderful explanation.

> 
> -- Steve
> 
> 
> >  		tracing_off();
> >  
> >  	if (trace_boot_clock) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-23 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22 13:43 [PATCH 1/2] kernel/trace: call helper function to check global_trace Yaowei Bai
2015-09-22 13:43 ` [PATCH 2/2] kernel/trace_probe: is_good_name can be boolean Yaowei Bai
2015-09-22 13:59   ` Steven Rostedt
2015-09-22 13:58 ` [PATCH 1/2] kernel/trace: call helper function to check global_trace Steven Rostedt
2015-09-23 13:49   ` Yaowei Bai

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).