public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Roland McGrath <roland@redhat.com>,
	Stanislaw Gruszka <sgruszka@redhat.com>,
	Vitaly Mayatskikh <vmayatsk@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ptrace: wait_task_zombie: do not account traced sub-threads
Date: Mon, 15 Jun 2009 23:26:48 +0200	[thread overview]
Message-ID: <20090615212648.GA22751@redhat.com> (raw)

The bug is ancient, the fix doesn't depend on other changes in -mm.

If we trace the sub-thread of our natural child and this sub-thread exits,
we update parent->signal->cxxx fields. But we should not do this until the
whole thread-group exits, otherwise we account this thread (and all other
live threads) twice.

Add the task_detached() check. No need to check thread_group_empty(),
wait_consider_task()->delay_group_leader() already did this.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- PTRACE/kernel/exit.c~1_WAIT_REPARENTED	2009-06-15 21:04:49.000000000 +0200
+++ PTRACE/kernel/exit.c	2009-06-15 22:26:02.000000000 +0200
@@ -1189,7 +1189,7 @@ static int wait_task_zombie(struct wait_
 
 	traced = ptrace_reparented(p);
 
-	if (likely(!traced)) {
+	if (likely(!traced) && likely(!task_detached(p))) {
 		struct signal_struct *psig;
 		struct signal_struct *sig;
 		struct task_cputime cputime;


             reply	other threads:[~2009-06-15 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 21:26 Oleg Nesterov [this message]
2009-06-16  0:45 ` [PATCH 1/2] ptrace: wait_task_zombie: do not account traced sub-threads Roland McGrath
2009-06-17 19:48   ` [rfc] ptrace: wait_task_zombie: fix the racy EXIT_ZOMBIE setting Oleg Nesterov
2009-06-18 18:47   ` [PATCH] ptrace-wait_task_zombie-do-not-account-traced-sub-threads-fix Oleg Nesterov

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=20090615212648.GA22751@redhat.com \
    --to=oleg@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=sgruszka@redhat.com \
    --cc=vmayatsk@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