Re: virtio: Add memory statistics reporting to the balloon driver

From: Rusty Russell
Date: Tue Nov 10 2009 - 21:43:34 EST


On Wed, 11 Nov 2009 10:37:56 am Anthony Liguori wrote:
> Rusty Russell wrote:
> > You register an outbuf at initialization time. The host hands it back when
> > it wants you to refill it with stats.
>
> That's strangely backwards. Guest send a stat buffer that's filled out,
> host acks it when it wants another. That doesn't seem bizarre to you?

Yep! But that's a limitation of our brains, not the infrastructure ;)

Think of the stats as an infinite stream of data. Read from it at your
leisure. This is how, for example, console output works.

> > But the universe is remarkably indifferent to what we want. Is it actually
> > sufficient or are we going to regret our laziness?
>
> It's not laziness, it's consistency. How is actual different than free
> memory or any other stat?

Because it's a COLLECTION of stats. For example, swap in should be < swap
out. Now, the current Linux implementation of all_vm_events() is non-atomic
anyway, so maybe we can just document this as best-effort. I'm saying that
if it *is* a problem, I think we need a vq.

But it raises the question: what stats are generally useful cross-OS? Should
we be supplying numbers like "unused" (free) "instantly discardable" (ie.
clean), "discardable to disk" (ie. file-backed), "discardable to swap"
(ie. swap-backed) and "unswappable" instead?

(I just made those up, of course, but it seems like that would give a fair
indication of real memory pressure in any OS).

Thanks,
Rusty.
--
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/