mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Davide Libenzi <davidel@xmailserver.org>,
	Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Robin Holt <holt@sgi.com>, Roland McGrath <roland@redhat.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] reparent kernel threads to swapper
Date: Tue, 10 Apr 2007 22:04:19 -0600	[thread overview]
Message-ID: <m1slb7v9oc.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20070410185222.GA107@tv-sign.ru> (Oleg Nesterov's message of "Tue, 10 Apr 2007 22:52:22 +0400")

Oleg Nesterov <oleg@tv-sign.ru> writes:

> A lot of kernel threads parented to /sbin/init slow down do_wait() when
> a non-detached (user-space) process exits. Change reparent_kthread() to
> use init_task as a parent. Since init_task can't go away, we don't need
> to put the caller on init_task.children list.

Is there any downside of putting tasks on init_task.children?

If not it is probably a good idea to put processes there just for good measure.

> NOTE: pstree doesn't show kernel threads with this patch.
>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
> --- 2.6.21-rc5/kernel/exit.c~3_SWAPPER	2007-04-10 21:59:41.000000000 +0400
> +++ 2.6.21-rc5/kernel/exit.c	2007-04-10 22:25:25.000000000 +0400
> @@ -255,11 +255,11 @@ static int has_stopped_jobs(struct pid *
>  }
>  
>  /**
> - * reparent_kthread - Reparent the calling kernel thread to the init task of
> the pid space that the thread belongs to.
> + * reparent_kthread - Reparent the calling kernel thread to swapper.
>   *
>   * If a kernel thread is launched as a result of a system call, or if
> - * it ever exits, it should generally reparent itself to init so that
> - * it is correctly cleaned up on exit.
> + * it ever exits, it should generally reparent itself so that it is
> + * correctly cleaned up on exit.
>   *
>   * The various task state such as scheduling policy and priority may have
>   * been inherited from a user process, so we reset them to sane values here.
> @@ -272,9 +272,8 @@ void reparent_kthread(void)
>  
>  	ptrace_unlink(current);
>  	remove_parent(current);
> -	current->parent = init_pid_ns.child_reaper;
> +	current->parent = &init_task;
>  	current->real_parent = current->parent;
> -	add_parent(current);
>  
>  	/* make the task auto-reap */
>  	current->exit_signal = -1;

      reply	other threads:[~2007-04-11  4:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 18:52 Oleg Nesterov
2007-04-11  4:04 ` Eric W. Biederman [this message]

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=m1slb7v9oc.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=holt@sgi.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=serge@hallyn.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®