[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v5 0/8] Make balloon drivers' memory changes known to the rest of the kernel


  • To: Konstantin Khlebnikov <koct9i@xxxxxxxxx>
  • From: Alexander Atanasov <alexander.atanasov@xxxxxxxxxxxxx>
  • Date: Wed, 19 Oct 2022 14:44:45 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sPflqNVTjcIJi0I6gleyxBPiVTz6DIBxSfsAWHMsG/E=; b=D5+DW4LP5A2aZfCk+0XBPatUqq2BHMY9Nnl9rWp+r15cmv6U/vaeu2XHuk0MER0pOqf8fns6MO/oatiUj3mlhpzFgkJWPfdA8K66096NrWre9C2o6NLautovYm2CvWApCIYWTb7QwVdOripnrjWArmPc+uSrRsJncXo3l31DnOVpr5x74VfcfCDJo4rQ2C+5QJZyhALDZ78tNWixov/xgQsSpeG+yHYg53rgM4f+3HJRA7I5bANn2KBkc9IICC3tCngEvYXSr28utVCvG9mGr6QaJI61b+OsREMf1SWwikAjG3BnQ0KzvU9JoTegbrXU2YSpml2AQnEj1r5DTnCfYQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwG5SIKcNgX7/zR8X5Wj5zq7ZPJFZut2NcgkYCAeJINDTMa3+gd1nsM5FFtutWVaFN60Xurcc+3JrIz77/xb0SQQ6q/3KhSsVaWJT89kuRT8fyp4T2RSI9YCOcoey30MlVdV2QgISI9LdX6kz+QhaPL+mYkLR3Czws+hzTDTimGr3MynYNP256rqbTWr8gmKVjjIXYabfc17K1bi0TdMzK1LEuHQgVF5VFq3H8m6eOn18BH5f99LAwYYI6tnKsFVZAHYeA4vDuoBloXCxqOmwbWnFcKlHA7P60H3BU2Nr1KeeAT54PD93dpQqRGTv5wuAm1msOCzZrHNNTTPPs6rrw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com;
  • Cc: kernel@xxxxxxxxxx, kernel test robot <lkp@xxxxxxxxx>, "Michael S . Tsirkin" <mst@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Nadav Amit <namit@xxxxxxxxxx>, pv-drivers@xxxxxxxxxx, Jason Wang <jasowang@xxxxxxxxxx>, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, linux-hyperv@xxxxxxxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 19 Oct 2022 11:44:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.10.22 13:53, Konstantin Khlebnikov wrote:
On Wed, 19 Oct 2022 at 12:57, Alexander Atanasov <alexander.atanasov@xxxxxxxxxxxxx <mailto:alexander.atanasov@xxxxxxxxxxxxx>> wrote:

    Currently balloon drivers (Virtio,XEN, HyperV, VMWare, ...)
    inflate and deflate the guest memory size but there is no
    way to know how much the memory size is changed by them.

    Make it possible for the drivers to report the values to mm core.

    Display reported InflatedTotal and InflatedFree in /proc/meminfo
    and print these values on OOM and sysrq from show_mem().

    The two values are the result of the two modes the drivers work
    with using adjust_managed_page_count or without.

    In earlier versions, there was a notifier for these changes
    but after discussion - it is better to implement it in separate
    patch series. Since it came out as larger work than initially expected.

    Amount of inflated memory can be used:
      - totalram_pages() users working with drivers not using
         adjust_managed_page_count
      - si_meminfo(..) users can improve calculations
      - by userspace software that monitors memory pressure


Sorry, I see no reason for that series.
Balloon inflation adjusts totalram_pages. That's enough.

That is not true in all cases - some do some do not.


There is no reason to know the amount of non-existent ballooned memory inside.

Why? Memory managment is becoming more and more dynamic - to make it easy and accurate you need to know that amount. The kernel itself on boot pre-allocates caches and sets limits based on total ram at boot time when balloon steals half of the memory these initial calculations become very wrong. To redo them correctly these amounts need to be known. The idea of doing this is thru a notifier chain in a separte series.

Management software which works outside should care about that.

For debugging you could get current balloon size from /proc/vmstat (balloon_inflate - balloon_deflate).

Currently you can do that only if using VMWare balloon.

Also (I guess) /proc/kpageflags has a bit for that.

Anyway it's easy to monitor balloon inflation by seeing changes of total memory size.

Not all drivers do that - VMWare and virtio (in one case) for example do not. I proposed to unify them but since it can break existing users it was NAKed.


    Alexander Atanasov (8):
       mm: Make a place for a common balloon code
       mm: Enable balloon drivers to report inflated memory
       mm: Display inflated memory to users
       mm: Display inflated memory in logs
       drivers: virtio: balloon - report inflated memory
       drivers: vmware: balloon - report inflated memory
       drivers: hyperv: balloon - report inflated memory
       documentation: create a document about how balloon drivers operate

      Documentation/filesystems/proc.rst            |   6 +
      Documentation/mm/balloon.rst                  | 138 ++++++++++++++++++
      MAINTAINERS                                   |   4 +-
      arch/powerpc/platforms/pseries/cmm.c          |   2 +-
      drivers/hv/hv_balloon.c                       |  12 ++
      drivers/misc/vmw_balloon.c                    |   3 +-
      drivers/virtio/virtio_balloon.c               |   7 +-
      fs/proc/meminfo.c                             |  10 ++
      .../linux/{balloon_compaction.h => balloon.h} |  18 ++-
      lib/show_mem.c                                |   8 +
      mm/Makefile                                   |   2 +-
      mm/{balloon_compaction.c => balloon.c}        |  19 ++-
      mm/migrate.c                                  |   1 -
      mm/vmscan.c                                   |   1 -
      14 files changed, 213 insertions(+), 18 deletions(-)
      create mode 100644 Documentation/mm/balloon.rst
      rename include/linux/{balloon_compaction.h => balloon.h} (91%)
      rename mm/{balloon_compaction.c => balloon.c} (94%)

    v4->v5:
      - removed notifier
      - added documentation
      - vmware update after op is done , outside of the mutex
    v3->v4:
      - add support in hyperV and vmware balloon drivers
      - display balloon memory in show_mem so it is logged on OOM and on
    sysrq
    v2->v3:
      - added missed EXPORT_SYMBOLS
    Reported-by: kernel test robot <lkp@xxxxxxxxx <mailto:lkp@xxxxxxxxx>>
      - instead of balloon_common.h just use balloon.h (yes, naming is hard)
      - cleaned up balloon.h - remove from files that do not use it and
        remove externs from function declarations
    v1->v2:
      - reworked from simple /proc/meminfo addition

    Cc: Michael S. Tsirkin <mst@xxxxxxxxxx <mailto:mst@xxxxxxxxxx>>
    Cc: David Hildenbrand <david@xxxxxxxxxx <mailto:david@xxxxxxxxxx>>
    Cc: Wei Liu <wei.liu@xxxxxxxxxx <mailto:wei.liu@xxxxxxxxxx>>
    Cc: Nadav Amit <namit@xxxxxxxxxx <mailto:namit@xxxxxxxxxx>>
    Cc: pv-drivers@xxxxxxxxxx <mailto:pv-drivers@xxxxxxxxxx>
    Cc: Jason Wang <jasowang@xxxxxxxxxx <mailto:jasowang@xxxxxxxxxx>>
    Cc: virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
    <mailto:virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx>
    Cc: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx <mailto:kys@xxxxxxxxxxxxx>>
    Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx
    <mailto:haiyangz@xxxxxxxxxxxxx>>
    Cc: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx
    <mailto:sthemmin@xxxxxxxxxxxxx>>
    Cc: Dexuan Cui <decui@xxxxxxxxxxxxx <mailto:decui@xxxxxxxxxxxxx>>
    Cc: linux-hyperv@xxxxxxxxxxxxxxx <mailto:linux-hyperv@xxxxxxxxxxxxxxx>
    Cc: Juergen Gross <jgross@xxxxxxxx <mailto:jgross@xxxxxxxx>>
    Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx
    <mailto:sstabellini@xxxxxxxxxx>>
    Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx
    <mailto:oleksandr_tyshchenko@xxxxxxxx>>
    Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
    <mailto:xen-devel@xxxxxxxxxxxxxxxxxxxx>

    base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 2.31.1


--
Regards,
Alexander Atanasov




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.