All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC] set the thread name
Date: Tue, 16 Jun 2009 20:39:52 +0200	[thread overview]
Message-ID: <1245177592.14543.1.camel@wall-e> (raw)

Currently it is not easy to identify a thread in linux, because there is
no thread name like in some other OS. 

If there were are thread name then we could extend a kernel segv message
and the /proc/<pid>/task/<tid>/... entries by a TName value like this:

cat /proc/492/task/495/status
Name:   test
TName:  RX-Data          <- this is the thread identification field
State:  S (sleeping)
Tgid:   492
Pid:    495
PPid:   1
.
.
.

This will it make much easier to determinate which thread id is
associated to a logical thread.

It would be possible do this without add a new entry to the task_struct.
Just use the comm entry which is available, because it has the same
value as the group_leader->comm entry.

The only thing to do is to replace all task_struct->comm access by
task_struct->group_leader->comm to have the old behavior. This can be
eventually encapsulated by a macro.

The task_struct->comm of a non group_leader would be than the name of
the thread.

The only drawback is that there are a lot of files which must be
modified. A quick
 find linux-2.6.30 -type f | xargs grep -l -e "->comm\>"  | wc -l
shows 215 files. But this can be handled.

So i propose a new system call to give a thread a name.

What do you think?

Greetings,
Stefani



WARNING: multiple messages have this Message-ID (diff)
From: Stefani Seibold <stefani@seibold.net>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC] set the thread name
Date: Tue, 16 Jun 2009 20:39:52 +0200	[thread overview]
Message-ID: <1245177592.14543.1.camel@wall-e> (raw)

Currently it is not easy to identify a thread in linux, because there is
no thread name like in some other OS. 

If there were are thread name then we could extend a kernel segv message
and the /proc/<pid>/task/<tid>/... entries by a TName value like this:

cat /proc/492/task/495/status
Name:   test
TName:  RX-Data          <- this is the thread identification field
State:  S (sleeping)
Tgid:   492
Pid:    495
PPid:   1
.
.
.

This will it make much easier to determinate which thread id is
associated to a logical thread.

It would be possible do this without add a new entry to the task_struct.
Just use the comm entry which is available, because it has the same
value as the group_leader->comm entry.

The only thing to do is to replace all task_struct->comm access by
task_struct->group_leader->comm to have the old behavior. This can be
eventually encapsulated by a macro.

The task_struct->comm of a non group_leader would be than the name of
the thread.

The only drawback is that there are a lot of files which must be
modified. A quick
 find linux-2.6.30 -type f | xargs grep -l -e "->comm\>"  | wc -l
shows 215 files. But this can be handled.

So i propose a new system call to give a thread a name.

What do you think?

Greetings,
Stefani


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2009-06-16 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 18:39 Stefani Seibold [this message]
2009-06-16 18:39 ` [RFC] set the thread name Stefani Seibold
2009-06-16 19:14 ` Bert Wesarg
2009-06-16 19:14   ` Bert Wesarg
2009-06-16 19:40   ` Stefani Seibold
2009-06-16 19:40     ` Stefani Seibold
2009-06-16 19:54   ` Stefani Seibold
2009-06-16 19:54     ` Stefani Seibold
2009-06-17  1:13   ` KOSAKI Motohiro
2009-06-17  1:13     ` KOSAKI Motohiro

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=1245177592.14543.1.camel@wall-e \
    --to=stefani@seibold.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.