Running on Ubuntu server, a CentOS 7 VM is eating the memory :


# free -m
              total        used        free      shared  buff/cache   available
Mem:          80140       71676        5346           7        3117        7655
Swap:          4095         265        3830

# ps_mem
 Private  +   Shared  =  RAM used   Program

 59.7 MiB +  67.4 MiB = 127.1 MiB   fail2ban-server (4)
189.2 MiB + 189.6 MiB = 378.8 MiB   mysqld
202.2 MiB + 206.9 MiB = 409.1 MiB   lxd (5)
128.5 MiB + 558.5 MiB = 687.0 MiB   systemd-journald (5)
 30.1 GiB +  30.3 GiB =  60.4 GiB   qemu-system-x86_64
                         62.8 GiB

# virsh dommemstat ispmanager-master
actual 33554432
swap_in 1214268
swap_out 6718144
major_fault 429115
minor_fault 27183560666
unused 569424
available 32779288
usable 19841256
last_update 1597820230
rss 33239928


# free -m
              total        used        free      shared  buff/cache   available
Mem:          32011       11235         548         978       20226       19403
Swap:         10235        2568        7667

# lsmod | grep virt
virtio_balloon         18015  0 
virtio_net             28114  0 
net_failover           18147  1 virtio_net
virtio_blk             18323  4 
virtio_console         28076  1 
virtio_pci             22985  0 
virtio_ring            22952  5 virtio_blk,virtio_net,virtio_pci,virtio_balloon,virtio_console
virtio                 14959  5 virtio_blk,virtio_net,virtio_pci,virtio_balloon,virtio_consol

# virsh dommemstat ispmanager-master
actual 33554432
swap_in 0
swap_out 168
major_fault 24275
minor_fault 796131035
unused 395204
available 32779288
usable 25097908
last_update 1597885620
rss 33535884

The guest config:

<domain type="kvm">
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://centos.org/centos/7.0"/>
  <memory unit="KiB">33554432</memory>
  <currentMemory unit="KiB">33554432</currentMemory>
  <vcpu placement="static">10</vcpu>
    <type arch="x86_64" machine="pc-i440fx-bionic">hvm</type>
    <vmport state="off"/>
  <cpu mode="custom" match="exact" check="partial">
    <model fallback="allow">Skylake-Server-IBRS</model>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native"/>
      <source dev="/dev/zvol/pool1/vm/isp-master"/>
      <target dev="vda" bus="virtio"/>
      <boot order="1"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native"/>
      <source dev="/dev/zvol/pool1/vm/isp-master-backups"/>
      <target dev="vdb" bus="virtio"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native"/>
      <source dev="/dev/zvol/ssd1/vm/isp-master"/>
      <target dev="vdc" bus="virtio"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x0a" function="0x0"/>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw"/>
      <target dev="hda" bus="ide"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    <controller type="usb" index="0" model="ich9-ehci1">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x7"/>
    <controller type="usb" index="0" model="ich9-uhci1">
      <master startport="0"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0" multifunction="on"/>
    <controller type="usb" index="0" model="ich9-uhci2">
      <master startport="2"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x1"/>
    <controller type="usb" index="0" model="ich9-uhci3">
      <master startport="4"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x2"/>
    <controller type="pci" index="0" model="pci-root"/>
    <controller type="ide" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
    <interface type="bridge">
      <mac address="52:54:00:83:c1:a8"/>
      <source bridge="br0"/>
      <model type="virtio"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
    <serial type="pty">
      <target type="isa-serial" port="0">
        <model name="isa-serial"/>
    <console type="pty">
      <target type="serial" port="0"/>
    <channel type="unix">
      <target type="virtio" name="org.qemu.guest_agent.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="2"/>
    <input type="tablet" bus="usb">
      <address type="usb" bus="0" port="1"/>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="2"/>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="3"/>
    <memballoon model="virtio">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x08" function="0x0"/>

What is wrong ? How can I fix it ?

  • Something is very wrong with the free -m output from your guest. The buff/cache number is much higher than it could possibly actually be, given the rest of the numbers. Have you changed this VM's memory configuration while it is running? – Michael Hampton Aug 19 '20 at 6:56
  • No it is set as it since a while. A few Host reboots occurred following kernel upgrade. – Laurent Aug 19 '20 at 7:00
  • So I have stopped the VM. 32GB of memory was still used by ... well I don't know (ps_mem wasn't showing that much memory uised). So I rebooted the host. And the problem is back after a while ... – Laurent Aug 20 '20 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.