Re: [RFC 2/2] virtio_balloon: auto-ballooning support

From: Luiz Capitulino
Date: Fri May 10 2013 - 09:28:26 EST


On Fri, 10 May 2013 09:20:46 -0400
Luiz Capitulino <lcapitulino@xxxxxxxxxx> wrote:

> On Thu, 9 May 2013 18:15:19 -0300
> Rafael Aquini <aquini@xxxxxxxxxx> wrote:
>
> > On Thu, May 09, 2013 at 10:53:49AM -0400, Luiz Capitulino wrote:
> > > Automatic ballooning consists of dynamically adjusting the guest's
> > > balloon according to memory pressure in the host and in the guest.
> > >
> > > This commit implements the guest side of automatic balloning, which
> > > basically consists of registering a shrinker callback with the kernel,
> > > which will try to deflate the guest's balloon by the amount of pages
> > > being requested. The shrinker callback is only registered if the host
> > > supports the VIRTIO_BALLOON_F_AUTO_BALLOON feature bit.
> > >
> > > Automatic inflate is performed by the host.
> > >
> > > Here are some numbers. The test-case is to run 35 VMs (1G of RAM each)
> > > in parallel doing a kernel build. Host has 32GB of RAM and 16GB of swap.
> > > SWAP IN and SWAP OUT correspond to the number of pages swapped in and
> > > swapped out, respectively.
> > >
> > > Auto-ballooning disabled:
> > >
> > > RUN TIME(s) SWAP IN SWAP OUT
> > >
> > > 1 634 930980 1588522
> > > 2 610 627422 1362174
> > > 3 649 1079847 1616367
> > > 4 543 953289 1635379
> > > 5 642 913237 1514000
> > >
> > > Auto-ballooning enabled:
> > >
> > > RUN TIME(s) SWAP IN SWAP OUT
> > >
> > > 1 629 901 12537
> > > 2 624 981 18506
> > > 3 626 573 9085
> > > 4 631 2250 42534
> > > 5 627 1610 20808
> > >
> > > Signed-off-by: Luiz Capitulino <lcapitulino@xxxxxxxxxx>
> > > ---
> >
> > Nice work Luiz! Just allow me a silly question, though.
>
> I have 100% more chances of committing sillynesses than you, so please
> go ahead.
>
> > Since your shrinker
> > doesn't change the balloon target size,
>
> Which target size are you referring to? The one in the host (member num_pages
> of VirtIOBalloon in QEMU)?
>
> If it the one in the host, then my understanding is that that member is only
> used to communicate the new balloon target to the guest. The guest driver
> will only read it when told (by the host) to do so, and when it does the
> target value will be correct.
>
> Am I right?
>
> > as soon as the shrink round finishes the
> > balloon will re-inflate again, won't it? Doesn't this cause a sort of "balloon
> > thrashing" scenario, if both guest and host are suffering from memory pressure?

Forgot to say that I didn't observe this in my testing. But I'll try harder
as soon as we clarify which target size we're talking about.
--
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/