Skip to contentSkip to conversation

acpi_os_queue_for_execution()

DISCUSSION Pavel Machek 2 participants 3 messages Dec 23, 2002 – Dec 29, 2002 ACPI

lore
Share & tools
lore
#0 lore raw

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...
Pavel

Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
#1 lore raw
Quoted 13 lines · Pavel Machek

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));
Quoted 4 lines

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...

This is the standard way to get process context [i.e. somewhere where you can sleep]. The new delayed-work workqueue code in 2.5.x does something almost exactly like that under the covers.

That said, it sounds like you found something to fix in ACPI:

In 2.4.x ACPI, it should be using schedule_task(), and in 2.5.x it should be using schedule_work(), if this is truly the intention of the ACPI subsystem.

There shouldn't be much reason to continually spawn single-run threads when there is already an API for doing so.

Jeff

#2 lore raw

Hi!

Quoted 11 lines
Quoted 11 lines

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));
Quoted 8 lines
Quoted 4 lines

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...

This is the standard way to get process context [i.e. somewhere where you can sleep]. The new delayed-work workqueue code in 2.5.x does something almost exactly like that under the covers.

Is it really true that fork() can not sleep?

Quoted 5 lines

That said, it sounds like you found something to fix in ACPI:

In 2.4.x ACPI, it should be using schedule_task(), and in 2.5.x it should be using schedule_work(), if this is truly the intention of the ACPI subsystem.

Agreed.
Pavel

Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.