Re: [RFC] Getting rid of useless daemons

From: Cesar Eduardo Barros (cesarb@web4u.com.br)
Date: Sun Apr 30 2000 - 09:14:10 EST


On Sun, Apr 30, 2000 at 09:02:28AM +0100, Russell King wrote:
> Cesar Eduardo Barros writes:
> > Now I think it's time to get rid of apmd, acpid and devfsd.
> >
> > apmd could be changed into an executable "callback", like kmod/modprobe.
>
> I don't think that would be a good idea. I'm already seeing apmd-induced
> problems, and this will make it worse. Take the following example:
>
> 1. hit the standby button
> 2. The laptop blanks its display, and tells the hard drive to spin down
> 3. apmd gets woken and writes a message to syslog, which writes it to the
> hard drive.

And in some systems, apmd calls a script after that step.

> The net result is that the disk has not been spun down. If I kill apmd off,
> then no message gets written to syslog, and it all works as expected. Now,
> if apmd is replaced with a "callback", then:
>
> 1, 2 as before
> 3. the "callback" is called which starts a program. Some sections of the
> text segment are read off the hard drive, preventing it from spinning
> down (again). The program will write a message to syslog, which will
> write it to the hard drive.

In my Debian install it already calls a "callback" script, not to mention apmd
probably will have to be read from the disk since it will have partially
swapped out.

> In this case, there is no apmd there to be killed off, and I can no longer
> put the hard drive to sleep.

You could disable the callback (probably by writing 0 bytes to some random
/proc file), and reenable it again when you want to use it. You could even have
separate files for different "callbacks" (like one for suspend, another for
resume, and another one for status updates).

> PS. I regard apmd's write-message-on-standy behaviour a bug.

The kernel should wait for an "ACK" from apmd before telling the BIOS to go on
with the shutdown, and apmd should only "ack" the shutdown request after
writing the syslog entry to the disk. This way the disk would spin down only
after the syslog message was written and sync()ed.

Of course, this means syslog() couldn't be used since it's non-blocking, so
apmd would have to do its own logging (and maybe send the info to a remote
syslog too if that's what you want).

-- 
Cesar Eduardo Barros
cesarb@web4u.com.br
cesarb@dcc.ufrj.br

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



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:18 EST