Re: Let init know user wants to shutdown [linux-power] [linux-pm-devel] [linux-kernel-mailing-list] [some-other-list]

David Woodhouse (dwmw2@infradead.org)
Fri, 27 Apr 2001 10:03:12 +0100


davem@redhat.com said:
> You can break the whole power management problem down to "here are the
> levels of low-power provided by the hardware, here are the idleness
> triggers that may be monitored". That's it, nothing more.
> This is powerful enough to do all the things you could want a pm layer
> to do:
>
> 1) CPU's have been in their idle threads for X percent of
> of the past measurement quantum, half clock the processors.
>
> 2) The user has hit the "sleep" trigger, spin down the disks,
> reduce clock the cpus, bus, PCI controller and PCI devices.

Often the 'sleep trigger' is an _absence_ of activity rather than anything
explicit like a button being pressed. You need inactivity timers, and events
which _reset_ those timers, on triggers like keyboard/touchscreen/serial
input, etc.

It's arguable that you can do that in userspace. Possibly - I'm not 100%
convinced of that. If you have many events which can reset many different
timers, the amount of traffic between kernel and user space just to reset
those timers may be quite high.

If an inactivity timer is implemented in userspace, with serial input being
one of the events that resets it, you're going to get a lot of wakeup/reset
events if you do a large download over that port.

It's possible that we could optimise that somehow, so we can avoid having
to implement PM timers in kernelspace. I'm not sure. Perhaps the wakeup
events could be on a separate queue, with no duplicates permitted, and the
PM daemon could poll that queue only when it's about to shoot one of its
timers.

For maximum efficiency, when receiving an event in sleep mode which isn't
supposed to wake the system, we should drop the event and go back to sleep
as quickly as possible. If you have to run userspace processes to make that
decision, it's not going to be particularly fast.

It may be sensible to have a simple policy engine in the kernel which
implement a policy provided by userspace. Some kind of simple state machine.

--
dwmw2

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/