public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories
@ 2009-02-25 23:41 Frederic Weisbecker
  2009-02-26  7:06 ` Frederic Weisbecker
  2009-02-26 13:14 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2009-02-25 23:41 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Steven Rostedt, Frederic Weisbecker,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Lai Jiangshan

Impact: scale per cpu tracing

The per cpu trace files are all in a single directory: /debug/tracing/per_cpu.
In case of a large number of cpu, the content of this directory becomes messy
so we create now one directory per cpu inside /debug/tracing/per_cpu which contain
each their own trace_pipe and trace files.

Ie:

nobody@nowhere:/debug/tracing$ ls -R per_cpu
per_cpu:
cpu0  cpu1

per_cpu/cpu0:
trace  trace_pipe

per_cpu/cpu1:
trace  trace_pipe

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/trace/trace.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b7eeecc..b1f7105 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3061,28 +3061,31 @@ struct dentry *tracing_dentry_percpu(void)
 static void tracing_init_debugfs_percpu(long cpu)
 {
 	struct dentry *d_percpu = tracing_dentry_percpu();
-	struct dentry *entry;
-	/* strlen(trace_pipe) + MAX(log10(cpu)) + '\0' */
-	char filename[17];
+	struct dentry *entry, *d_cpu;
+	/* strlen(cpu) + MAX(log10(cpu)) + '\0' */
+	char cpu_dir[7];
 
 	if (cpu > 999 || cpu < 0)
 		return;
 
-	/* per cpu trace_pipe */
-	sprintf(filename, "trace_pipe%ld", cpu);
+	sprintf(cpu_dir, "cpu%ld", cpu);
+	d_cpu = debugfs_create_dir(cpu_dir, d_percpu);
+	if (!d_cpu) {
+		pr_warning("Could not create debugfs '%s' entry\n", cpu_dir);
+		return;
+	}
 
-	entry = debugfs_create_file(filename, 0444, d_percpu,
+	/* per cpu trace_pipe */
+	entry = debugfs_create_file("trace_pipe", 0444, d_cpu,
 				(void *) cpu, &tracing_pipe_fops);
 	if (!entry)
-		pr_warning("Could not create debugfs '%s' entry\n", filename);
+		pr_warning("Could not create debugfs 'trace_pipe' entry\n");
 
 	/* per cpu trace */
-	sprintf(filename, "trace%ld", cpu);
-
-	entry = debugfs_create_file(filename, 0444, d_percpu,
+	entry = debugfs_create_file("trace", 0444, d_cpu,
 				(void *) cpu, &tracing_fops);
 	if (!entry)
-		pr_warning("Could not create debugfs '%s' entry\n", filename);
+		pr_warning("Could not create debugfs 'trace' entry\n");
 
 }
 
-- 
1.6.1



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

* Re: [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories
  2009-02-25 23:41 [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories Frederic Weisbecker
@ 2009-02-26  7:06 ` Frederic Weisbecker
  2009-02-26 13:14 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2009-02-26  7:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Steven Rostedt,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Lai Jiangshan

On Thu, Feb 26, 2009 at 12:41:38AM +0100, Frederic Weisbecker wrote:
> Impact: scale per cpu tracing
> 
> The per cpu trace files are all in a single directory: /debug/tracing/per_cpu.
> In case of a large number of cpu, the content of this directory becomes messy
> so we create now one directory per cpu inside /debug/tracing/per_cpu which contain
> each their own trace_pipe and trace files.
> 
> Ie:
> 
> nobody@nowhere:/debug/tracing$ ls -R per_cpu
> per_cpu:
> cpu0  cpu1
> 
> per_cpu/cpu0:
> trace  trace_pipe
> 
> per_cpu/cpu1:
> trace  trace_pipe
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>


Oh, I forgot to mention: they apply on top of latest -tip + the ftrace_bprintk 3 patches.


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

* Re: [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories
  2009-02-25 23:41 [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories Frederic Weisbecker
  2009-02-26  7:06 ` Frederic Weisbecker
@ 2009-02-26 13:14 ` Ingo Molnar
  2009-02-26 13:22   ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-02-26 13:14 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Linux Kernel Mailing List, Steven Rostedt,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Lai Jiangshan


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Impact: scale per cpu tracing
> 
> The per cpu trace files are all in a single directory: 
> /debug/tracing/per_cpu. In case of a large number of cpu, the 
> content of this directory becomes messy so we create now one 
> directory per cpu inside /debug/tracing/per_cpu which contain 
> each their own trace_pipe and trace files.

Applied to tip:tracing/ftrace, thanks Frederic!

	Ingo

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

* Re: [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories
  2009-02-26 13:14 ` Ingo Molnar
@ 2009-02-26 13:22   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-02-26 13:22 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Linux Kernel Mailing List, Steven Rostedt,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Lai Jiangshan


* Ingo Molnar <mingo@elte.hu> wrote:

> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > Impact: scale per cpu tracing
> > 
> > The per cpu trace files are all in a single directory: 
> > /debug/tracing/per_cpu. In case of a large number of cpu, the 
> > content of this directory becomes messy so we create now one 
> > directory per cpu inside /debug/tracing/per_cpu which contain 
> > each their own trace_pipe and trace files.
> 
> Applied to tip:tracing/ftrace, thanks Frederic!

The layout looks much more structured on a 16-way box now:

phoenix:/debug/tracing/per_cpu> ll
total 0
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu0
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu1
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu10
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu11
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu12
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu13
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu14
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu15
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu2
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu3
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu4
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu5
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu6
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu7
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu8
drwxr-xr-x 2 root root 0 2009-02-26 14:19 cpu9
phoenix:/debug/tracing/per_cpu> cd cpu0
phoenix:/debug/tracing/per_cpu/cpu0> ll
total 0
-r--r--r-- 1 root root 0 2009-02-26 14:19 trace
-r--r--r-- 1 root root 0 2009-02-26 14:19 trace_pipe
phoenix:/debug/tracing/per_cpu/cpu0> 

	Ingo

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

end of thread, other threads:[~2009-02-26 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 23:41 [PATCH 1/2] tracing/core: make the per cpu trace files in per cpu directories Frederic Weisbecker
2009-02-26  7:06 ` Frederic Weisbecker
2009-02-26 13:14 ` Ingo Molnar
2009-02-26 13:22   ` Ingo Molnar

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