> From: Pavel Machek [mailto:[email protected]]
> Acpi seems to create short-lived kernel threads, and I don't quite
> understand why.
>
> In thermal.c
>
>
> tz->timer.data = (unsigned long) tz;
> tz->timer.function = acpi_thermal_run;
> tz->timer.expires = jiffies + (HZ *
> sleep_time) / 1000;
> add_timer(&(tz->timer));
>
> and acpi_thermal_run creates kernel therad that runs
> acpi_thermal_check. Why is not acpi_thermal_check called directly? I
> don't like idea of thread being created every time thermal zone needs
> to be polled...
Are we allowed to block in a timer callback? One of the things
thermal_check does is call a control method, which in turn can be very
slow, sleep, etc., so I'd guess that's why the code tries to execute
things in its own thread.
Regards -- Andy
On Fri, Jan 03, 2003 at 11:00:04AM -0800, Grover, Andrew wrote:
> Are we allowed to block in a timer callback? One of the things
> thermal_check does is call a control method, which in turn can be very
> slow, sleep, etc., so I'd guess that's why the code tries to execute
> things in its own thread.
timers are run in bottom-half context. no sleeping allowed. if you're
going to linux.conf.au, you'll want to attend my talk that deals with
exactly this kind of thing ;-)
i'll put the paper up on the web in a couple of weeks, after the
proceedings are published.
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Hi Andrew,
On Fri, Jan 03, 2003 at 11:00:04AM -0800, Grover, Andrew wrote:
> > From: Pavel Machek [mailto:[email protected]]
> > Acpi seems to create short-lived kernel threads, and I don't quite
> > understand why.
[...]
> > and acpi_thermal_run creates kernel therad that runs
> > acpi_thermal_check. Why is not acpi_thermal_check called directly? I
> > don't like idea of thread being created every time thermal zone needs
> > to be polled...
>
> Are we allowed to block in a timer callback? One of the things
> thermal_check does is call a control method, which in turn can be very
> slow, sleep, etc., so I'd guess that's why the code tries to execute
> things in its own thread.
No you just have to switch completely to schedule_work() as you
do for calls from interrupts. The limitations you mention in
osl.c for this function are lifted (look at linux/kernel/workqueue.c) and
we have per CPU workqueues now.
So no need for this uglification and less code to maintain for
you ;-)
The short lived threads are not necessary anymore. If this
thermal check will happen often an extra permanent thread for
this, which is kicked by a timer might be more apropriate here.
That thread could be started, once the thermal control is loaded.
Regards
Ingo Oeser
--
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
Hi!
> > Acpi seems to create short-lived kernel threads, and I don't quite
> > understand why.
> >
> > In thermal.c
> >
> >
> > tz->timer.data = (unsigned long) tz;
> > tz->timer.function = acpi_thermal_run;
> > tz->timer.expires = jiffies + (HZ *
> > sleep_time) / 1000;
> > add_timer(&(tz->timer));
> >
> > and acpi_thermal_run creates kernel therad that runs
> > acpi_thermal_check. Why is not acpi_thermal_check called directly? I
> > don't like idea of thread being created every time thermal zone needs
> > to be polled...
>
> Are we allowed to block in a timer callback? One of the things
> thermal_check does is call a control method, which in turn can be very
> slow, sleep, etc., so I'd guess that's why the code tries to execute
> things in its own thread.
But... Creating a kernel thread can block, too? [Correct me if I'm
wrong, but creating a kernel thread looks like a *lot* of semaphores
taken to me].
Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.