APM support for avoiding waking up laptops every few seconds?

Greg Stark (gsstark@mit.edu)
03 Aug 1997 03:52:02 -0400

It would be nice if the laptop feature to spin down the drive weren't
nearly completely defeated by Unix's intelligent memory management. I
know people have suggested (and implemented) disabling updating atime
as a solution, but i think that would only help a little. Really, all
disk activity should be avoided and delayed whenever the disk is spun

Ideally what i would like to see would be,

1 Just before the APM spins down the disk, a sync should be done.
Though i'm not actually sure there's any way to request such notice.

2 Whenever the disk is spun down sys_bdflush should be a noop
The idea being that eventually a read will wake up the disk and all
those dirty buffers will be flushed within five seconds. This will
suck up a lot buffers but if the free list is empty refill_freelist
will still work fine.

3 A lot better behaviour in keeping unused buffers around
Currently if i run the same program repeatedly i still occasionally
hear pages getting read. And if i run a program every 30s it has to
be paged in every time.

I realize the buffer architecture has changed in 2.1 hopefully it has
improved on the last point.

Incidentally if you're worried about buffers not being committed soon
enough and users losing critical data, frankly, hearing the disk spin
down is a pretty unambiguous interface indicating that if the machine
panicked right that moment any writes would be lost. Users can always
run `sync' if it's absolutely critical.