From: Andrew Morton <akpm@linux-foundation.org>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
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] kthread: Don't depend on work queues
Date: Wed, 11 Apr 2007 00:03:16 -0700 [thread overview]
Message-ID: <20070411000316.52f2551e.akpm@linux-foundation.org> (raw)
In-Reply-To: <m13b37v517.fsf@ebiederm.dsl.xmission.com>
On Tue, 10 Apr 2007 23:44:36 -0600 ebiederm@xmission.com (Eric W. Biederman) wrote:
> Currently there is a circular reference between work queue initialization
> and kthread initialization. This prevents the kernel thread
> infrastructure from initializing until after work queues have been
> initialized.
>
> For kernel threads we want something that is as close as possible to the
> init_task and is not contaminated by user processes. The later we start
> our kthreadd that forks the rest of the kernel threads the harder this is
> to do and the more of a mess we have to clean up because the defaults have
> changed on us.
>
> So this patch modifies the kthread support to not use work queues but to
> instead use a simple list of structures, and to have kthreadd start from
> init_task immediately after our kernel thread that execs /sbin/init.
>
> By being a true child of init_task we only have to change those process
> settings that we want to have different from init_task, such as our
> process name, blocking all signals and setting SIGCHLD to SIG_IGN
> so that all of our children are reaped automatically.
>
> By being a tre child of init_task we also naturally get our ppid set to 0
> and do not wind up as a child of PID == 1. Ensuring that kernel threads
> will not slow down the functioning of the wait family of functions.
argh. Your description freely confuddles the terms "kernel thread" and
"kthread". Can we not do that? Henceforth the term "kernel thread" refers
to something which was started with kernel_thread() and "kthread" refers to
something which was created by kthread_create(), OK?
Your patch gets midly tangled up with Oleg's recent
reduce-reparent_to_init.patch
make-kernel-threads-invisible-to-sbin-init.patch
reparent-kernel-threads-to-swapper.patch
but they seemed fairly unpopular anyway so I'll drop 'em.
Your wait_event() will contribute to load average, I expect. We get mail.
I converted it to wait_event_interruptible().
I guess using PF_NOFREEZE rather than try_to_freeze() is OK, but one
wonders what thinking led to that?
Often when we have a singleton thread like this it is neater to use
wake_up_process() directly on it, rather than creating a rather pointless
waitqueue_head for it. I started looking into that but it would have taken
more than 30 seconds.
next prev parent reply other threads:[~2007-04-11 7:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 18:51 [PATCH 2/3] make kernel threads invisible to /sbin/init Oleg Nesterov
2007-04-10 23:16 ` Serge E. Hallyn
2007-04-11 3:29 ` Eric W. Biederman
2007-04-11 3:56 ` Eric W. Biederman
2007-04-11 11:42 ` Oleg Nesterov
2007-04-11 5:44 ` [PATCH] kthread: Don't depend on work queues Eric W. Biederman
2007-04-11 7:03 ` Andrew Morton [this message]
2007-04-11 10:13 ` Rafael J. Wysocki
2007-04-11 11:21 ` Gautham R Shenoy
2007-04-11 11:48 ` Oleg Nesterov
2007-04-11 13:31 ` Gautham R Shenoy
2007-04-11 14:36 ` Oleg Nesterov
2007-04-11 19:37 ` Rafael J. Wysocki
2007-04-11 14:44 ` Rafael J. Wysocki
2007-04-11 18:22 ` Eric W. Biederman
2007-04-11 18:27 ` [PATCH] kthread: Don't depend on work queues (take 2) Eric W. Biederman
2007-04-11 18:49 ` [PATCH] Change reparent_to_init to reparent_to_kthreadd Eric W. Biederman
2007-04-11 19:21 ` [PATCH] kthread: Don't depend on work queues (take 2) Andrew Morton
2007-04-11 19:28 ` Oleg Nesterov
2007-04-11 19:40 ` Eric W. Biederman
2007-04-11 19:49 ` Oleg Nesterov
2007-04-11 20:02 ` Eric W. Biederman
2007-04-11 12:04 ` [PATCH] kthread: Don't depend on work queues Oleg Nesterov
2007-04-11 16:25 ` Eric W. Biederman
2007-04-11 13:15 ` Oleg Nesterov
2007-04-11 16:22 ` Eric W. Biederman
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=20070411000316.52f2551e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=ebiederm@xmission.com \
--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 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.