Dynamic memory allocation in KVM

10,247

The behaviour you describe is simply the way the balloon driver operates. The hypervisor exposes a virtual machine with 12 GB of virtual DIMMs installed. The balloon driver then grabs 8 GB of this memory and gives it back to the hypervisor. The way it grabs memory varies per guest OS, but essentially it has to allocate it to make it appear to be in use, thus preventing the guest OS using it. The balloon driver does not automatically adjust depending on guest workload requirements. So if your windows guests needs more than 4 GB, you need to use libvirt/virsh on the host OS to change the balloon level, to give some of the "used" 8 GB back to the guest OS. If you want the guest OS to see & use the full 12 GB, simply don't use the balloon driver at all.

Share:
10,247
raks
Author by

raks

Love to integrate systems and think ideas to develop new web services.

Updated on June 09, 2022

Comments

  • raks
    raks almost 2 years

    I have Ubuntu 16.04 host over which I installed a Virtual guest (Windows server 2012) using KVM. The total RAM available is 16 GB.

    I have installed virtio balloon drivers. I have allocated 4GB current memory and 12GB maximum memory to the windows. However the windows sees 8GB unallocated memory as used memory.

    Memory usage in Guest

    When I open some heavy applications the memory assigned is limited to the available memory from 4GB. The computer behaves in the same manner when full memory is being utilized in the windows (does not run smoothly).

    The windows can see all the 12 GB RAM but can only utilize 4 GB. How do I ensure that windows can utilize all off the 12GB of memory?