← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1244045] Re: Memory calculation is not accurate for KVM hypervisor

 

** Changed in: nova
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1244045

Title:
  Memory calculation is not accurate for KVM hypervisor

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  Currently, the resource tracker get the free memory from virt driver.

  In libvirt environment, if the below hypervisor is not Xen, it will
  use  memory summary of 'MemFree:', 'Buffers:' and Cached:'" for
  calculation. However, this is not correct.

  I'd give an example below, the environment is a devstack environment,
  with host has 8G RAM. Ubuntu 12.04 host with swap disabled (enable
  swap should not impact this).

  1) Create two flavor, test with 4G memory, and mtest with 2G memory.

  2) Create 3 instance, 2 for test flavor, 1 for mtest flavor. The 3
  instance can be created successfully.

  3) In each guest, execute followed program, which is mainly allocate memory and populate it.
  #include <stdlib.h>

  int main() {
      int *p;
      while(1) {
          int inc=1024*1024*sizeof(char);
          p=(int*) calloc(1,inc);
          if(!p) break;
      }
  }

  4) After sometime, in my test environment, two guest has been killed
  because of host OOM.

  This is sure to not be good. I don't know why this problem is not
  reported before.

  The reason for this issue is, the KVM allocate guest memory as a progressive method:
  a) when guest started, qemu will malloc() for the virtual address ranges for the guest.
  b) When guest access the memory, the memory will be populated as needed.

  Thus when we create instance, there is not much memory access thus
  from host point of view, still a lot of memory existed. However, once
  guest begin access the memory as in step 3), host will out of memory.

  Thanks
  --jyh

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1244045/+subscriptions