tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

disk writes & energy budget (was Re: fifo and [acm]time)

On Wed, Dec 28, 2011 at 05:59:07PM +0200, Alan Barrett wrote:
> On Mon, 26 Dec 2011, Taylor R Campbell wrote:
> >>Is one inode update per minute enough to be a significant issue?
> >
> >It means the disk must continue spinning and, e.g., will continue
> >to draw power from a laptop battery to do so, even when the system
> >is functionally idle.
> I think that's a more general problem.  It would be nice if all
> updates to atime/mtime/ctime could be buffered in memory (not
> committed to stable storage) until either the disk happens to be
> spinning anyway, or the amount of memory "wasted" in buffering the
> updates is too large, or the updates are forced using a mechanism
> like fsync(2) or sync(2).
> I even want syslogd's writes to /var/log/messages to be buffered
> until the disk happens to be spinning anyway.

Maybe it is possible to solve these problems in a general way by marking
each individual write buffer with a tiny energy budget and charging the
energy required to spin up a disk to the energy budget accumulated on
its buffer queue.

Say that a certain disk takes 72000 milli-Joules (mJ) to spin up, and
6000 milli-Watts (mW) to spin the disk.  Also, say that each mtime
update has an energy budget of 72 mJ and each syslogd write has a budget
of 7200 mJ.  When 999 mtime updates and one (1) syslogd write have
queued on that disk, the cumulative energy budget of 79128 mJ is more
than enough to spin up the disk.  After the 72000-mJ spin-up is charged
against the buffer queue, the residual 7128 mJ power budget is enough to
spin the disk for about 1.2 seconds.  After 1.2 seconds, the disk will
spin down unless its power budget is replenished.

If the power budget assigned to each individual write buffer draws
on some other power budget---say the budget of an open file, or a
process---and if every ordinary power budget draws on another budget or
a supply (battery, AC), then I think that you have the beginnings of a
useful framework for power-saving.  Disk writes are not the only things
that would draw down power budgets: so would network transmissions, and
LWPs running on a CPU.


David Young    Urbana, IL    (217) 721-9981

Home | Main Index | Thread Index | Old Index