Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH 0/3] tracing/user_events: More efficient data output in user_seq_show()
@ 2026-06-04 12:05 Markus Elfring
  2026-06-04 12:07 ` [PATCH 1/3] tracing/user_events: Simplify " Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Markus Elfring @ 2026-06-04 12:05 UTC (permalink / raw)
  To: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Steven Rostedt
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 14:00:56 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Simplify data output
  Use seq_putc()
  Replace a seq_printf() call by seq_puts()

 kernel/trace/trace_events_user.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.54.0


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

* [PATCH 1/3] tracing/user_events: Simplify data output in user_seq_show()
  2026-06-04 12:05 [PATCH 0/3] tracing/user_events: More efficient data output in user_seq_show() Markus Elfring
@ 2026-06-04 12:07 ` Markus Elfring
  2026-06-09 16:13   ` Steven Rostedt
  2026-06-04 12:10 ` [PATCH 2/3] tracing/user_events: Use seq_putc() " Markus Elfring
  2026-06-04 12:12 ` [PATCH 3/3] tracing/user_events: Replace a seq_printf() call by seq_puts() " Markus Elfring
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2026-06-04 12:07 UTC (permalink / raw)
  To: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Steven Rostedt
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 13:33:43 +0200

Move the specification for a line break from a seq_puts() call
to a seq_printf() call.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/trace/trace_events_user.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index c4ba484f7b38..a089ac30e407 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -2800,8 +2800,7 @@ static int user_seq_show(struct seq_file *m, void *p)
 
 	mutex_unlock(&group->reg_mutex);
 
-	seq_puts(m, "\n");
-	seq_printf(m, "Active: %d\n", active);
+	seq_printf(m, "\nActive: %d\n", active);
 	seq_printf(m, "Busy: %d\n", busy);
 
 	return 0;
-- 
2.54.0


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

* [PATCH 2/3] tracing/user_events: Use seq_putc() in user_seq_show()
  2026-06-04 12:05 [PATCH 0/3] tracing/user_events: More efficient data output in user_seq_show() Markus Elfring
  2026-06-04 12:07 ` [PATCH 1/3] tracing/user_events: Simplify " Markus Elfring
@ 2026-06-04 12:10 ` Markus Elfring
  2026-06-04 12:12 ` [PATCH 3/3] tracing/user_events: Replace a seq_printf() call by seq_puts() " Markus Elfring
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2026-06-04 12:10 UTC (permalink / raw)
  To: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Steven Rostedt
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 13:40:38 +0200

A line break should be put into a sequence within a loop.
Thus use the corresponding function “seq_putc” for one selected call.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/trace/trace_events_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index a089ac30e407..1a0569110bfd 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -2794,7 +2794,7 @@ static int user_seq_show(struct seq_file *m, void *p)
 			busy++;
 		}
 
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 		active++;
 	}
 
-- 
2.54.0


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

* [PATCH 3/3] tracing/user_events: Replace a seq_printf() call by seq_puts() in user_seq_show()
  2026-06-04 12:05 [PATCH 0/3] tracing/user_events: More efficient data output in user_seq_show() Markus Elfring
  2026-06-04 12:07 ` [PATCH 1/3] tracing/user_events: Simplify " Markus Elfring
  2026-06-04 12:10 ` [PATCH 2/3] tracing/user_events: Use seq_putc() " Markus Elfring
@ 2026-06-04 12:12 ` Markus Elfring
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2026-06-04 12:12 UTC (permalink / raw)
  To: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Steven Rostedt
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 13:45:48 +0200

A single string should be put into a sequence within a loop.
Thus use the corresponding function “seq_puts” for one selected call.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/trace/trace_events_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 1a0569110bfd..57a78de4dc98 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -2781,7 +2781,7 @@ static int user_seq_show(struct seq_file *m, void *p)
 	hash_for_each(group->register_table, i, user, node) {
 		status = user->status;
 
-		seq_printf(m, "%s", EVENT_TP_NAME(user));
+		seq_puts(m, EVENT_TP_NAME(user));
 
 		if (status != 0) {
 			seq_puts(m, " # Used by");
-- 
2.54.0


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

* Re: [PATCH 1/3] tracing/user_events: Simplify data output in user_seq_show()
  2026-06-04 12:07 ` [PATCH 1/3] tracing/user_events: Simplify " Markus Elfring
@ 2026-06-09 16:13   ` Steven Rostedt
  2026-06-09 16:44     ` Markus Elfring
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2026-06-09 16:13 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-trace-kernel, Masami Hiramatsu, Mathieu Desnoyers, LKML,
	kernel-janitors

On Thu, 4 Jun 2026 14:07:45 +0200
Markus Elfring <Markus.Elfring@web.de> wrote:

> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -2800,8 +2800,7 @@ static int user_seq_show(struct seq_file *m, void *p)
>  
>  	mutex_unlock(&group->reg_mutex);
>  
> -	seq_puts(m, "\n");
> -	seq_printf(m, "Active: %d\n", active);
> +	seq_printf(m, "\nActive: %d\n", active);
>  	seq_printf(m, "Busy: %d\n", busy);

This isn't a critical section and I find the original way easier to
read. But the other two patches are fine.

-- Steve

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

* Re: [PATCH 1/3] tracing/user_events: Simplify data output in user_seq_show()
  2026-06-09 16:13   ` Steven Rostedt
@ 2026-06-09 16:44     ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2026-06-09 16:44 UTC (permalink / raw)
  To: Steven Rostedt, linux-trace-kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, LKML, kernel-janitors

>> @@ -2800,8 +2800,7 @@ static int user_seq_show(struct seq_file *m, void *p)
>>  
>>  	mutex_unlock(&group->reg_mutex);
>>  
>> -	seq_puts(m, "\n");
>> -	seq_printf(m, "Active: %d\n", active);
>> +	seq_printf(m, "\nActive: %d\n", active);
>>  	seq_printf(m, "Busy: %d\n", busy);
> 
> This isn't a critical section and I find the original way easier to read.

Would you prefer to use a seq_putc() call instead at such a source code place?
https://elixir.bootlin.com/linux/v7.1-rc7/source/kernel/trace/trace_events_user.c#L2803


> But the other two patches are fine.
Thanks for another bit of positive feedback.

Regards,
Markus

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

end of thread, other threads:[~2026-06-09 16:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 12:05 [PATCH 0/3] tracing/user_events: More efficient data output in user_seq_show() Markus Elfring
2026-06-04 12:07 ` [PATCH 1/3] tracing/user_events: Simplify " Markus Elfring
2026-06-09 16:13   ` Steven Rostedt
2026-06-09 16:44     ` Markus Elfring
2026-06-04 12:10 ` [PATCH 2/3] tracing/user_events: Use seq_putc() " Markus Elfring
2026-06-04 12:12 ` [PATCH 3/3] tracing/user_events: Replace a seq_printf() call by seq_puts() " Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox