← Back to team overview

kernel-packages team mailing list archive

[Bug 1587087] [NEW] OOM in guest Ubuntu with inflated balloon

 

Public bug reported:

There is QEMU/KVM and a Linux OS running inside the guest.
Inside the Linux guest a balloon consumes memory in accordance with
commands performed on the host side in QEMU. Rapid increases of memory consumption
inside the guest may end up with guest OOMs
since memory locked by balloon couldn’t be returned to the guest OS/vm in time.

The problem is addressed in mainstream Linux with the following
patchset:

commit 5a10b7dbf904bfe01bb9fcc6298f7df09eed77d5
Author: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
Date: Mon Nov 10 09:36:29 2014 +1030
virtio_balloon: free some memory from balloon on OOM

    Excessive virtio_balloon inflation can cause invocation of OOM-killer,
    when Linux is under severe memory pressure. Various mechanisms are
    responsible for correct virtio_balloon memory management. Nevertheless
    it is often the case that these control tools does not have enough time
    to react on fast changing memory load. As a result OS runs out of memory
    and invokes OOM-killer. The balancing of memory by use of the virtio
    balloon should not cause the termination of processes while there are
    pages in the balloon. Now there is no way for virtio balloon driver to
    free some memory at the last moment before some process will be get
    killed by OOM-killer.

    This does not provide a security breach as balloon itself is running
    inside guest OS and is working in the cooperation with the host. Thus
    some improvements from guest side should be considered as normal.

    To solve the problem, introduce a virtio_balloon callback which is
    expected to be called from the oom notifier call chain in out_of_memory()
    function. If virtio balloon could release some memory, it will make
    the system to return and retry the allocation that forced the out of
    memory killer to run.

    Allocate virtio feature bit for this: it is not set by default,
    the the guest will not deflate virtio balloon on OOM without explicit
    permission from host.

    Signed-off-by: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
    Signed-off-by: Denis V. Lunev <den@xxxxxxxxxx>
    Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

commit 1fd9c67203af91977bf3b964ff3744cf74fc6f3f
Author: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
Date: Mon Nov 10 09:35:29 2014 +1030

    virtio_balloon: return the amount of freed memory from
leak_balloon()

    This value would be useful in the next patch to provide the amount of
    the freed memory for OOM killer.

    Signed-off-by: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
    Signed-off-by: Denis V. Lunev <den@xxxxxxxxxx>
    CC: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
    CC: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

The problem is present in Ubuntu 14.10

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1587087

Title:
  OOM in guest Ubuntu with inflated balloon

Status in linux package in Ubuntu:
  New

Bug description:
  There is QEMU/KVM and a Linux OS running inside the guest.
  Inside the Linux guest a balloon consumes memory in accordance with
  commands performed on the host side in QEMU. Rapid increases of memory consumption
  inside the guest may end up with guest OOMs
  since memory locked by balloon couldn’t be returned to the guest OS/vm in time.

  The problem is addressed in mainstream Linux with the following
  patchset:

  commit 5a10b7dbf904bfe01bb9fcc6298f7df09eed77d5
  Author: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
  Date: Mon Nov 10 09:36:29 2014 +1030
  virtio_balloon: free some memory from balloon on OOM

      Excessive virtio_balloon inflation can cause invocation of OOM-killer,
      when Linux is under severe memory pressure. Various mechanisms are
      responsible for correct virtio_balloon memory management. Nevertheless
      it is often the case that these control tools does not have enough time
      to react on fast changing memory load. As a result OS runs out of memory
      and invokes OOM-killer. The balancing of memory by use of the virtio
      balloon should not cause the termination of processes while there are
      pages in the balloon. Now there is no way for virtio balloon driver to
      free some memory at the last moment before some process will be get
      killed by OOM-killer.

      This does not provide a security breach as balloon itself is running
      inside guest OS and is working in the cooperation with the host. Thus
      some improvements from guest side should be considered as normal.

      To solve the problem, introduce a virtio_balloon callback which is
      expected to be called from the oom notifier call chain in out_of_memory()
      function. If virtio balloon could release some memory, it will make
      the system to return and retry the allocation that forced the out of
      memory killer to run.

      Allocate virtio feature bit for this: it is not set by default,
      the the guest will not deflate virtio balloon on OOM without explicit
      permission from host.

      Signed-off-by: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
      Signed-off-by: Denis V. Lunev <den@xxxxxxxxxx>
      Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
      Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

  commit 1fd9c67203af91977bf3b964ff3744cf74fc6f3f
  Author: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
  Date: Mon Nov 10 09:35:29 2014 +1030

      virtio_balloon: return the amount of freed memory from
  leak_balloon()

      This value would be useful in the next patch to provide the amount of
      the freed memory for OOM killer.

      Signed-off-by: Raushaniya Maksudova <rmaksudova@xxxxxxxxxxxxx>
      Signed-off-by: Denis V. Lunev <den@xxxxxxxxxx>
      CC: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
      CC: Michael S. Tsirkin <mst@xxxxxxxxxx>
      Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

  The problem is present in Ubuntu 14.10

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1587087/+subscriptions


Follow ups