Comment 14 for bug 315970

Revision history for this message
Eloy Paris (peloy-chapus) wrote : Re: [Bug 315970] Re: g-p-m should use less frequent disk writes

Hi Scott,

On Sun, Jul 12, 2009 at 01:31:57AM -0000, Scott Howard wrote:

> Thanks for explaining this. The problem is the GPM relies on writing to
> the HD to keep track of power history, which causes a lot of disk
> writes. This isn't a bug in that it wastes energy, but that it causes
> disk activity. Marking as confirmed and wishlist since
>
> This should be sent directly to the upstream authors at
> bugzilla.gnome.org, for forwarding instructions please have a look to
> http://wiki.ubuntu.com/Bugs/Upstream/GNOME. If you forward the bug,
> please post a link to the upstream bug report here. Also, mention how
> your bug is different than what is written in the FAQ I linked, so they
> don't dismiss it for that reason. Thanks in advance.
>
> ** Summary changed:
>
> - g-p-m keeps disk spinning
> + g-p-m should use less frequent disk writes

The problem is not that g-p-m is writing to disk often; the problem is
that it is writing to disk *and* calling fsync().

Take for instance the laptop-mode-tools suite -- it enables a feature
of the Linux kernel that will keep all recent disk writes in memory
and then write to disk all of them at once at fixed intervals. So,
if an application tries to write to disk, that write does not happen
immediately. This has the benefit that the hard disk can spindown for
several minutes and there is guarantee that it will not spinup before
the next scheduled batch write operation (unless of course something
needs to be read from the disk.)

Now, if the application or a library it uses calls the fsync() system
call then the disk will be woken up before the next scheduled batch
write operation. This is what is happening with g-p-m -- when writing to
these files that keep power history something is calling fsync(). This
is what should be looked into.

g-p-m is not the only application that has this problem; Firefox itself
has it (or had it; it is not clear to me whether they've fixed the
issue.) The following Firefox bug explains the issue in detail:

https://bugzilla.mozilla.org/show_bug.cgi?id=421482

And this blog entry from one of the Firefox developers has a lot of
great information about the issue in Firefox:

http://shaver.off.net/diary/2008/05/25/fsyncers-and-curveballs/

I searched upstream Bugzilla and didn't find any bug about this issue on
g-p-m so we definitely need to make sure upstream knows about the issue.

With regards to the FAQ you mentioned, it seems like upstream has
changed their mind with regards to support for hard disk spindown in
g-p-m. See this g-p-m bug:

http://bugzilla.gnome.org/show_bug.cgi?id=586582

Cheers,

Eloy Paris.-