All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dor Laor <dlaor@redhat.com>
To: tfjellstrom@shaw.ca
Cc: kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>
Subject: Re: automatic memory ballooning?
Date: Sun, 16 Aug 2009 18:07:07 +0300	[thread overview]
Message-ID: <4A88209B.3090908@redhat.com> (raw)
In-Reply-To: <200908160818.46436.tfjellstrom@shaw.ca>

On 08/16/2009 05:18 PM, Thomas Fjellstrom wrote:
> On Sun August 16 2009, Avi Kivity wrote:
>> On 08/16/2009 12:55 PM, Thomas Fjellstrom wrote:
>>> I'm wondering if kvm supports automatic memory ballooning. I've had a kvm
>>> guest running for a couple days, and the balloon driver was loaded, and I
>>> could manually change the amount of ram it had allocated in the console,
>>> but it never seemed to change automatically.
>>>
>>> Is there any support for that?
>>
>> That would be part of a management application.  qemu only knows about
>> the guest it controls, while ballooning needs a global view of the system.
>
> All a single guest needs to do is only use as much ram as it needs at any
> given time (up to the max allocated). So if the guest hasn't used much ram in
> a given time frame, "free" the free ram from the host, and only reallocate
> when needed. It doesn't _need_ a management application, just happens to be
> the way people do it.
>

This is far from being an accurate description of the reality ( ;) )
You cannot just expect the guest to do so. The guest has page cache that 
uses memory, it might run many processes that consume lots of memory, etc.
Even if you could have done it, the translation between the guest-host 
is not 1-1 and the host needs to be aware of the guest memory usage.

This is what ballooning does. A target is determined by host management 
daemon. As a response, the guest balloon driver try to allocate memory 
and pass it as Guest Physical Addresses to the host. Now the host can 
use madvise in order to mark these pages as not needed (and free the mmu 
of pinning them).

The complexity is for the management to dynamically shift memory between 
the host and the guest to reach maximum performance.

Regards,
Dor

  parent reply	other threads:[~2009-08-16 15:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-16  9:55 automatic memory ballooning? Thomas Fjellstrom
2009-08-16 11:32 ` Avi Kivity
2009-08-16 14:18   ` Thomas Fjellstrom
2009-08-16 14:30     ` Avi Kivity
2009-08-16 15:07     ` Dor Laor [this message]
2009-08-17 10:49       ` Thomas Fjellstrom
2009-08-17 11:35         ` Avi Kivity
2009-08-17 12:32           ` Thomas Fjellstrom
2009-08-17 12:46             ` Avi Kivity
2009-08-17 12:33   ` Thomas Fjellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A88209B.3090908@redhat.com \
    --to=dlaor@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=tfjellstrom@shaw.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.