public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Andy Lutomirski <luto@amacapital.net>
Cc: linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH] proc: Document that /proc/<pid>/task/<tid>/children really is per-thread
Date: Mon, 01 Jul 2013 11:49:58 -0500	[thread overview]
Message-ID: <1372697398.5019.1@driftwood> (raw)
In-Reply-To: <5f9a6b3ab75b12f2c5ba61ea1f6f3b08e9952b55.1372280661.git.luto@amacapital.net> (from luto@amacapital.net on Wed Jun 26 16:05:01 2013)

On 06/26/2013 04:05:01 PM, Andy Lutomirski wrote:
> I was surprised to discover that a process can have a parent that  
> isn't
> a thread group leader.  (The usual ppid interfaces hide this, but the
> children list exposes it.)
> 
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> ---
>  Documentation/filesystems/proc.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/filesystems/proc.txt  
> b/Documentation/filesystems/proc.txt
> index fd8d0d5..205796a 100644
> --- a/Documentation/filesystems/proc.txt
> +++ b/Documentation/filesystems/proc.txt
> @@ -1623,6 +1623,12 @@ This file provides a fast way to retrieve  
> first level children pids
>  of a task pointed by <pid>/<tid> pair. The format is a space  
> separated
>  stream of pids.
> 
> +This really is a per-thread list.  If a process's parent is a thread,
> +then that process will appear in that thread's children list.  (This
> +means that, for any pid, /proc/pid/task/*/children are disjoint  
> lists.)
> +This may be surprising, as /proc/pid/status's PPid field is parent's
> +tgid as opposed to the parent's tid.

I've read this twice and still don't quite understand what it's saying.  
(Possibly I need more than 3 hours of sleep.)

It sounds like you're saying a thread can fork() and exec() and this  
makes proc look weird, because the ppid pooints to the thread group  
leader and not the thread, but the proc info listing us as a child  
belongs to the thread?

Is this a bug that should be fixed rather than documented? (Showing the  
right ppid for this corner case?)

Rob

  parent reply	other threads:[~2013-07-01 16:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 19:51 [PATCH] proc: Expose /proc/<pid>/task/<tid>/children unconditionally Andy Lutomirski
2013-06-25 20:16 ` Cyrill Gorcunov
2013-06-25 20:17   ` Oleg Nesterov
2013-06-25 21:36     ` Andy Lutomirski
2013-06-25 21:52       ` Cyrill Gorcunov
2013-06-25 22:01         ` Andy Lutomirski
2013-06-26  7:21           ` Cyrill Gorcunov
2013-06-26 15:57           ` Oleg Nesterov
2013-06-26 16:14             ` Andy Lutomirski
2013-06-26 21:05             ` [PATCH] proc: Document that /proc/<pid>/task/<tid>/children really is per-thread Andy Lutomirski
2013-06-27  6:21               ` Cyrill Gorcunov
2013-07-01 16:49               ` Rob Landley [this message]
2013-07-01 17:36                 ` Andy Lutomirski

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=1372697398.5019.1@driftwood \
    --to=rob@landley.net \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    /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