public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Matthieu CASTET <matthieu.castet@parrot.com>,
	ltt-dev@lists.casi.polymtl.ca, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>,
	rostedt@goodmis.org,
	Michael Kerrisk <mtk.manpages@googlemail.com>
Subject: Re: Tracing thread name (was: ltt comm tracking)
Date: Mon, 03 Aug 2009 16:28:27 +0200	[thread overview]
Message-ID: <1249309707.7924.101.camel@twins> (raw)
In-Reply-To: <20090803134843.GB23455@Krystal>

On Mon, 2009-08-03 at 09:48 -0400, Mathieu Desnoyers wrote:
> * Matthieu CASTET (matthieu.castet@parrot.com) wrote:
> > Hi,
> > 
> > I use ltt on a 2.6.27 on an arm architecture.
> > It works quite well, but I have a minor problem :
> > 
> > my application sets thread name with prctl PR_SET_NAME. But ltt viewer
> > doesn't seem to saw it.
> >
> 
> Hrm, I guess we might want to instrument set_task_comm as you propose to
> get the correct process name, but if this gets us the thread name, I
> think it's only an implementation side-effect:
> 
> If I look at the man page:
> 
> PRCTL(2)
> 
>        PR_SET_NAME (since Linux 2.6.9)
>               Set the process name for the calling process, using the value in
>               the location pointed to by (char *) arg2.  The name can be up to
>               16  bytes  long,  and  should  be null terminated if it contains
>               fewer bytes.
> 
> It seems to officially set the process name, not thread name.

Then the man page is wrong, it really only sets the task (thread) name.

> The way LTTng handles thread names is by adding a userspace "thread
> branding" event. It should be executed at thread startup. The downside
> of the current LTTng approach is that we cannot know the name of threads
> already executing before we started tracing.
> 
> Ideally, having something like prctl PR_SET/GET_THREAD_NAME would
> probably make sense.

Going by the current behaviour, you'd need to add process name.

fs/exec.c:

        void set_task_comm(struct task_struct *tsk, char *buf)
        {
                task_lock(tsk);
                strlcpy(tsk->comm, buf, sizeof(tsk->comm));
                task_unlock(tsk);
                perf_counter_comm(tsk);
        }


  reply	other threads:[~2009-08-03 14:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4A76E42D.7010908@parrot.com>
2009-08-03 13:48 ` Tracing thread name (was: ltt comm tracking) Mathieu Desnoyers
2009-08-03 14:28   ` Peter Zijlstra [this message]
2009-08-04 10:12   ` Tracing thread name Matthieu CASTET
2009-08-04 13:05     ` Mathieu Desnoyers
2009-08-04 14:06       ` Matthieu CASTET
2009-08-13 15:57         ` [ltt-dev] " Matthieu CASTET

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=1249309707.7924.101.camel@twins \
    --to=peterz@infradead.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltt-dev@lists.casi.polymtl.ca \
    --cc=matthieu.castet@parrot.com \
    --cc=mingo@elte.hu \
    --cc=mtk.manpages@googlemail.com \
    --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