]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/page_alloc.c: calculate 'available' memory in a separate function
authorIgor Redko <redkoi@virtuozzo.com>
Thu, 17 Mar 2016 21:19:05 +0000 (14:19 -0700)
committerBrian Maly <brian.maly@oracle.com>
Wed, 7 Aug 2019 22:00:11 +0000 (18:00 -0400)
commitb9f3bcd78f2e8c0b70b9612afb69d7389cfd66c6
tree9d5c81818c9ba2cdb6ea31573da20e6b3d05860f
parentda42dc7d2baf99de3a58f8dc3d20143ed36515a1
mm/page_alloc.c: calculate 'available' memory in a separate function

Add a new field, VIRTIO_BALLOON_S_AVAIL, to virtio_balloon memory
statistics protocol, corresponding to 'Available' in /proc/meminfo.

It indicates to the hypervisor how big the balloon can be inflated
without pushing the guest system to swap.  This metric would be very
useful in VM orchestration software to improve memory management of
different VMs under overcommit.

This patch (of 2):

Factor out calculation of the available memory counter into a separate
exportable function, in order to be able to use it in other parts of the
kernel.

In particular, it appears a relevant metric to report to the hypervisor
via virtio-balloon statistics interface (in a followup patch).

Signed-off-by: Igor Redko <redkoi@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit d02bd27bd33dd7e8d22594cd568b81be0cb584cd)

Orabug: 30073695

Need this to provide si_mem_available() for the next patch

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Patrick Colp <patrick.colp@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
fs/proc/meminfo.c: we don't have commit 84ad5802a33a ("proc:
        meminfo: estimate available memory more conservatively") and
        even though it looks reasonable and simple I didn't want to
        include it because this would change a user-visible attribute.

Signed-off-by: Brian Maly <brian.maly@oracle.com>
fs/proc/meminfo.c
include/linux/mm.h
mm/page_alloc.c