public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 3/4] perf tools: Unify swapper tasks naming
Date: Mon, 31 Aug 2009 06:52:23 +0200	[thread overview]
Message-ID: <20090831045222.GA6603@nowhere> (raw)
In-Reply-To: <1251693921-6579-3-git-send-email-fweisbec@gmail.com>

On Mon, Aug 31, 2009 at 06:45:20AM +0200, Frederic Weisbecker wrote:
> In perf tools, we hardcode the pid 0 cmdline resolving to "idle"
> because the init task is not included in the COMM events.
> 
> But the idle tasks secondary cpus are resolved into their "init"
> name through the COMM events.
> We have then such strange result in perf report (ditto with trace):
> 
>     19.66%       init    [kernel]          [k] acpi_idle_enter_c1
>     17.32%       [idle]  [kernel]          [k] acpi_idle_enter_c1
>


And BTW, idle/boot cpu is the only task that has square brackets.
Either these should be removed or we could add these brackets
to every kernel task coms.

I've tried with the following patch. It doesn't change anything, I'm not
sure why, I haven't yet investigate much for now:

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d988dfb..3753c39 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3230,10 +3230,15 @@ static void perf_counter_comm_event(struct perf_comm_event *comm_event)
 	struct perf_cpu_context *cpuctx;
 	struct perf_counter_context *ctx;
 	unsigned int size;
-	char comm[TASK_COMM_LEN];
+	char comm[TASK_COMM_LEN + 2]; /* Also reserve square backets */
 
 	memset(comm, 0, sizeof(comm));
-	strncpy(comm, comm_event->task->comm, sizeof(comm));
+
+	if (comm_event->task->mm)
+		strncpy(comm, comm_event->task->comm, sizeof(comm));
+	else
+		snprintf(comm, sizeof(comm), "[%s]", comm_event->task->comm);
+
 	size = ALIGN(strlen(comm)+1, sizeof(u64));
 
 	comm_event->comm = comm;



  reply	other threads:[~2009-08-31  4:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31  1:32 [PATCH] perf tools: Add missing parameters documentation Frederic Weisbecker
2009-08-31  4:45 ` [PATCH 1/4] perf tools: Librarize idle thread registration Frederic Weisbecker
2009-08-31  8:37   ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
2009-08-31  4:45 ` [PATCH 2/4] perf tools: Resolve idle thread cmdline for perf trace Frederic Weisbecker
2009-08-31  8:37   ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
2009-08-31  4:45 ` [PATCH 3/4] perf tools: Unify swapper tasks naming Frederic Weisbecker
2009-08-31  4:52   ` Frederic Weisbecker [this message]
2009-08-31  8:37   ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
2009-08-31  4:45 ` [PATCH 4/4] perf tools: Complete support for dynamic strings Frederic Weisbecker
2009-08-31  8:11   ` Ingo Molnar
2009-08-31 16:59     ` Frederic Weisbecker
2009-09-03 16:13       ` Ingo Molnar
2009-08-31  8:37   ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
2009-08-31  8:37 ` [tip:perfcounters/core] perf tools: Add missing parameters documentation tip-bot for Frederic Weisbecker

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=20090831045222.GA6603@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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