linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernel threads
@ 2001-08-16 22:23 Christian Widmer
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Widmer @ 2001-08-16 22:23 UTC (permalink / raw)
  To: linux-kernel

i'm new to in developing kernel software under linux and what to 
know if i'm write when i create kernel_threads like this:

variant I
---------
1) call kernel_thread 
2) in the thread function 
    a) get the big kernel lock
    b) call daemonize
    c) release big kernel lock


variant II
----------
schedule the call to kernel_thread using tq_schedule


- is there no need to call daemonize in the second variant - if yes why?
- can i do both variants during interupt time (when there is no valid 
current)?

chris

^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <no.id>]
* kernel threads
@ 2001-12-13  7:05 blesson paul
  0 siblings, 0 replies; 14+ messages in thread
From: blesson paul @ 2001-12-13  7:05 UTC (permalink / raw)
  To: linux-kernel

Hi all
			I am trying to compile a program which is using kernel_thread and its 
related functions.  I am not trying to compile as a standalone application. 
I am not sure  wheather I am doing right. I am able to compile the 
application. But I am not able to link. The error it shows is that, it 
cannot find the implementation of kernel_thread and all. But there is no 
libraries to link. How to tackle the problem.

	Also how to create the program as a patch to the kernel
Thanking in advance
regards
Blesson Paul



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


^ permalink raw reply	[flat|nested] 14+ messages in thread
* kernel threads.
@ 2002-04-12 17:07 Vahid Fereydunkolahi
  2002-04-12 17:45 ` Masoud Sharbiani
  0 siblings, 1 reply; 14+ messages in thread
From: Vahid Fereydunkolahi @ 2002-04-12 17:07 UTC (permalink / raw)
  To: linux-kernel

Folks,
 I have a problem using kernel_thread. The problem is
 when I use kernel threads I see a lot of context 
switch. 
 I monitor the system activity using vmstat.

Regards,
--vahid


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

^ permalink raw reply	[flat|nested] 14+ messages in thread
* kernel threads
@ 2002-11-20  9:36 Madhavi
  0 siblings, 0 replies; 14+ messages in thread
From: Madhavi @ 2002-11-20  9:36 UTC (permalink / raw)
  To: linux-kernel


Hi

Where can I get information about using linux kernel threads? Can anyone
give me some pointers?

Is there any function that I can use to exit from a thread? The
exit_thread() function of linux kernel 2.4.19 for i386 platform doesn't
seem to be doing anything.

If I can replace threads by tasklets, which would be advantageous in terms
of performance?

thanks & regards
Madhavi.


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Kernel threads
@ 2007-03-06 16:03 linux-os (Dick Johnson)
  2007-03-08  9:00 ` Andrew Morton
  0 siblings, 1 reply; 14+ messages in thread
From: linux-os (Dick Johnson) @ 2007-03-06 16:03 UTC (permalink / raw)
  To: Linux kernel; +Cc: Larson, Greg


Hello,

In linux-2.6.16.24, there is a problem with kernel threads
and the aic79xx.c driver.

When nash is executing /initrd/linuxrc in the initial RAM disk
during boot, it will be installing drivers. One driver, aic79xx.c
creates some kernel threads that will exit after the initialization
procedure. Actually the number of tasks depends upon the number
of disks found as the driver spawns these tasks so initialization
can occur in the background. The kernel tasks have been 'parented'
to init. This may be fine for the real init, but nash and other
shells receive the SIGCHLD signal and think that the fork()/exec()
they have executed is complete. This makes nash insert drivers
when the needed previous ones have not yet initialized. Also, when
booting a shell, the signals from the exiting kernel tasks confuse
it.

I think the top-level thread, kthread, should be reaping children
instead of init, which in some cases isn't even running yet.

Any comments?

The current work-around of putting `sleep 10` in linuxrc after
installing each driver is a hack of the worse kind. Especially,
considering an Adaptec controller with many drives attached may
require 'sleep 60'!


Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.68 BogoMips).
New book: http://www.AbominableFirebug.com/
_
\x1a\x04

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Kernel threads
@ 2007-03-08 16:38 Oleg Nesterov
  2007-03-09  0:31 ` Roland McGrath
  0 siblings, 1 reply; 14+ messages in thread
From: Oleg Nesterov @ 2007-03-08 16:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-os (Dick Johnson), Roland McGrath, linux-kernel

Andrew Morton wrote:
>
> > On Tue, 6 Mar 2007 11:03:48 -0500 "linux-os \(Dick Johnson\)" <linux-os@analogic.com> wrote:
> >
> > In linux-2.6.16.24, there is a problem with kernel threads
> > and the aic79xx.c driver.
> >
> > When nash is executing /initrd/linuxrc in the initial RAM disk
> > during boot, it will be installing drivers. One driver, aic79xx.c
> > creates some kernel threads that will exit after the initialization
> > procedure. Actually the number of tasks depends upon the number
> > of disks found as the driver spawns these tasks so initialization
> > can occur in the background. The kernel tasks have been 'parented'
> > to init. This may be fine for the real init, but nash and other
> > shells receive the SIGCHLD signal and think that the fork()/exec()
> > they have executed is complete. This makes nash insert drivers
> > when the needed previous ones have not yet initialized. Also, when
> > booting a shell, the signals from the exiting kernel tasks confuse
> > it.
>
> ug.  I've always disliked the kernel's dependence upon init to reap exitted
> kernel threads.  It Just Seems Wrong.

Yes. It is ugly to kick init to reap the kernel thread. I was going to
do this change a long ago, but I don't have time to do even a minimal
testing now.

reparent_to_init() expects that thread_group_empty() == true anyway,
we can set ->exit_signal = -1 and make this thread invisible to init.

Roland, what do you think?

Oleg.

--- WQ/kernel/exit.c~rti	2007-02-18 22:56:49.000000000 +0300
+++ WQ/kernel/exit.c	2007-03-08 19:26:39.000000000 +0300
@@ -276,8 +276,8 @@ static void reparent_to_init(void)
 	current->parent = child_reaper(current);
 	add_parent(current);
 
-	/* Set the exit signal to SIGCHLD so we signal init on exit */
-	current->exit_signal = SIGCHLD;
+	/* make the task autoreap */
+	current->exit_signal = -1;
 
 	if (!has_rt_policy(current) && (task_nice(current) < 0))
 		set_user_nice(current, 0);


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-03-09 23:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-16 22:23 kernel threads Christian Widmer
     [not found] <no.id>
2001-08-16 22:37 ` Alan Cox
2001-08-21 12:15   ` Christian Widmer
2001-12-13  7:05 blesson paul
2002-04-12 17:07 Vahid Fereydunkolahi
2002-04-12 17:45 ` Masoud Sharbiani
2002-11-20  9:36 Madhavi
2007-03-06 16:03 Kernel threads linux-os (Dick Johnson)
2007-03-08  9:00 ` Andrew Morton
2007-03-08 16:38 Oleg Nesterov
2007-03-09  0:31 ` Roland McGrath
2007-03-09 20:52   ` Oleg Nesterov
2007-03-09 21:38     ` Roland McGrath
2007-03-09 23:46       ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).