Re: [rfc] Ignore Fsync Calls in Laptop_Mode

From: Ted Ts'o
Date: Mon May 30 2011 - 22:03:54 EST


On Mon, May 30, 2011 at 11:24:03PM +0200, D. Jansen wrote:
> > do you really have so many fsync's going on that the disk spins up so much
> > that you would gain 10-20% battery life?
>
> Yes. Every autosave in LibreOffice triggers one. And I want autosave,
> but I want them in memory, not on disk.

What on *heck* good does an autosave to memory do? Are you afraid
your X server is going to go poof, or OpenOffice is going to crash on
you? I can't remember the last time this has happened to me. It's
typically a system crash or a power loss that causes me to lose an
OpenOffice session.

> > and what makes you think the extra spin-ups from fsyncs will cause your hard
> > drive to fail significantly earlier? (if you have a hard drive with a
> > limited number of spin-up cycles, you probably don't want to use laptop mode
> > at all)
>
> Experience, see above. Also, this is well described behavior. All hard
> disks are only designed to last a certain number of head loads and
> unloads. Spinning up and down even less.

Modern laptop drives are designed for 600,000 to a million head loads
and unloads. Open Office by default autosaves once every 15 minutes.
So if you leave your system running (on battery?!?) 24x7, with open
office open all that time, even with HDD which is only rated for 600k
load cycles, that's 4.5 years. And of course, normally such a system
is powered all the time, and the hard drive shouldn't be spinning down
if you're on the AC mains.

The real fix is that applications need to be fixed to be less
write-happy. Firefox example, used to request a transactional update
to a sqllite database on every web click. Laptop mode isn't the right
place to fix this, since if you try to stop the writes from hitting
the disk, you'll still end up burning memory that can't be released
until the data is written to disk. My guess is that it's not
OpenOffice which is causing you the problem, unless you've adjusted
the autosave interval, in which case it's your own fault. It's
probably some application like firefox, or syslog. (Syslog can be
fixed by prefixing syslog.conf entries with the '-' character so that
the files aren't sync'ed after every log update, for example. Or not
to log as much in the first place.)

- Ted


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