* automatic memory ballooning? @ 2009-08-16 9:55 Thomas Fjellstrom 2009-08-16 11:32 ` Avi Kivity 0 siblings, 1 reply; 10+ messages in thread From: Thomas Fjellstrom @ 2009-08-16 9:55 UTC (permalink / raw) To: kvm 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? -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 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-17 12:33 ` Thomas Fjellstrom 0 siblings, 2 replies; 10+ messages in thread From: Avi Kivity @ 2009-08-16 11:32 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm 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. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 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 2009-08-17 12:33 ` Thomas Fjellstrom 1 sibling, 2 replies; 10+ messages in thread From: Thomas Fjellstrom @ 2009-08-16 14:18 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity 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. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-16 14:18 ` Thomas Fjellstrom @ 2009-08-16 14:30 ` Avi Kivity 2009-08-16 15:07 ` Dor Laor 1 sibling, 0 replies; 10+ messages in thread From: Avi Kivity @ 2009-08-16 14:30 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm 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. > Well, for a single guest you are correct, but this is better solved generically for multiple guests. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-16 14:18 ` Thomas Fjellstrom 2009-08-16 14:30 ` Avi Kivity @ 2009-08-16 15:07 ` Dor Laor 2009-08-17 10:49 ` Thomas Fjellstrom 1 sibling, 1 reply; 10+ messages in thread From: Dor Laor @ 2009-08-16 15:07 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, Avi Kivity 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-16 15:07 ` Dor Laor @ 2009-08-17 10:49 ` Thomas Fjellstrom 2009-08-17 11:35 ` Avi Kivity 0 siblings, 1 reply; 10+ messages in thread From: Thomas Fjellstrom @ 2009-08-17 10:49 UTC (permalink / raw) To: kvm, dlaor; +Cc: Avi Kivity On Sun August 16 2009, Dor Laor wrote: > 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 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html One thing I found odd about kvm's ballooning is that it actually seems to change how much ram the guest has. I really didn't expect "free -m" to report that the guest only had 64M ram after I manually ballooned the ram. I was however expecting it just to free ram it wasn't using in the host. To me, it just doesn't seem to be the same thing. now it'll start swapping at 64M ram instead of just reallocating the ram it used to have. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-17 10:49 ` Thomas Fjellstrom @ 2009-08-17 11:35 ` Avi Kivity 2009-08-17 12:32 ` Thomas Fjellstrom 0 siblings, 1 reply; 10+ messages in thread From: Avi Kivity @ 2009-08-17 11:35 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, dlaor On 08/17/2009 01:49 PM, Thomas Fjellstrom wrote: > One thing I found odd about kvm's ballooning is that it actually seems to > change how much ram the guest has. I really didn't expect "free -m" to report > that the guest only had 64M ram after I manually ballooned the ram. I was > however expecting it just to free ram it wasn't using in the host. To me, it > just doesn't seem to be the same thing. now it'll start swapping at 64M ram > instead of just reallocating the ram it used to have. > You expectations aren't realistic. kvm never allocates the ram the guest doesn't use in the first place. Ballooning just the "free" memory is pointless since it's usually a very small amount. It may be worthwhile for the guest to give up that memory voluntarily though. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-17 11:35 ` Avi Kivity @ 2009-08-17 12:32 ` Thomas Fjellstrom 2009-08-17 12:46 ` Avi Kivity 0 siblings, 1 reply; 10+ messages in thread From: Thomas Fjellstrom @ 2009-08-17 12:32 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity, dlaor On Mon August 17 2009, Avi Kivity wrote: > On 08/17/2009 01:49 PM, Thomas Fjellstrom wrote: > > One thing I found odd about kvm's ballooning is that it actually seems to > > change how much ram the guest has. I really didn't expect "free -m" to > > report that the guest only had 64M ram after I manually ballooned the > > ram. I was however expecting it just to free ram it wasn't using in the > > host. To me, it just doesn't seem to be the same thing. now it'll start > > swapping at 64M ram instead of just reallocating the ram it used to have. > > You expectations aren't realistic. kvm never allocates the ram the > guest doesn't use in the first place. Really? So htop is lying to me then? I gave 1G ram to a kvm linux guest using virtio (disk, net, ballooning), and RES clearly said 1G, and VIRT actually said somewhere around 1.3 to 1.6G. It stayed that way for over a day, and the guest did nothing the entire time. I know the kernel lies a little bit about ram usage, but it seems at least with kvm, the ram is in use when it says it is, while with vmware, it usually isn't. > Ballooning just the "free" > memory is pointless since it's usually a very small amount. > It may be worthwhile for the guest to give up that memory voluntarily > though. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-17 12:32 ` Thomas Fjellstrom @ 2009-08-17 12:46 ` Avi Kivity 0 siblings, 0 replies; 10+ messages in thread From: Avi Kivity @ 2009-08-17 12:46 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, dlaor On 08/17/2009 03:32 PM, Thomas Fjellstrom wrote: > On Mon August 17 2009, Avi Kivity wrote: > >> On 08/17/2009 01:49 PM, Thomas Fjellstrom wrote: >> >>> One thing I found odd about kvm's ballooning is that it actually seems to >>> change how much ram the guest has. I really didn't expect "free -m" to >>> report that the guest only had 64M ram after I manually ballooned the >>> ram. I was however expecting it just to free ram it wasn't using in the >>> host. To me, it just doesn't seem to be the same thing. now it'll start >>> swapping at 64M ram instead of just reallocating the ram it used to have. >>> >> You expectations aren't realistic. kvm never allocates the ram the >> guest doesn't use in the first place. >> > Really? So htop is lying to me then? Of course not. > I gave 1G ram to a kvm linux guest using > virtio (disk, net, ballooning), and RES clearly said 1G, and VIRT actually > said somewhere around 1.3 to 1.6G. It stayed that way for over a day, and the > guest did nothing the entire time. > VIRT size is pointless, it includes tons of shared libraries which don't really affect memory usage. Try cat /proc/$pid/maps (or pmap $pid) on a qemu instance and see. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: automatic memory ballooning? 2009-08-16 11:32 ` Avi Kivity 2009-08-16 14:18 ` Thomas Fjellstrom @ 2009-08-17 12:33 ` Thomas Fjellstrom 1 sibling, 0 replies; 10+ messages in thread From: Thomas Fjellstrom @ 2009-08-17 12:33 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity 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. Where can I find such a management application? -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-08-17 12:46 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).