Re: Laptop Mode
On Tue, Sep 14, 2004 at 08:32:28AM +0200, Jens Axboe wrote:
> On Mon, Sep 13 2004, Daniel Kobras wrote:
> > On Mon, Sep 13, 2004 at 08:16:09AM +0200, Jens Axboe wrote:
> > > additionally, laptop mode can do things like automatic flushing of dirty
> > > data when you spin your drive up for other activity.
> > The latter being included in noflushd as well. It comes with a few more
> How does that work reliably?
Reliability is a different matter. The current implementation watches
the read stats for a sleeping disk. If new activity is detected, the
disk is synced. I'm quite aware of the shortcomings in this heuristic,
but it catches the common case, and works fairly well in practice.
> > fancy feature like different policies per disk, optionally preventing
> > spindown when machine is used interactively, etc. Oh, and it works with
> > kernels that predate the laptop-mode patch. The ordinary laptop user
> > won't care, and is usually better off with laptop-mode these days.
> Sounds useful. laptop mode support in kernel should only do the
> absolutely necessary, like spin-up detection. You should adapt your
> stuff to laptop mode.
> The noflushd approach was never very clean imho, it was a case of 'this
> is where we can do it with a hook' and not designed in place.
It was a kludge from the very beginning, when bdflush was pushed into
the kernel, but its sleep support had to stay out. Therefore, noflushd
was coded as an all-userland solution, and has been hunting for
information that would be readily available in-kernel ever since.
Actually, I'd guess the biggest part of the code deals with digging
stuff out of /proc. For this reason, it might be better to throw away
all the cruft and include the few features in a clean, new, and shiny
laptop-mode-daemon. Hey, even noflushd's name is crappy!