From: David Hildenbrand <david@redhat.com>
To: Nitesh Narayan Lal <nitesh@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, pbonzini@redhat.com, lcapitulino@redhat.com,
pagupta@redhat.com, wei.w.wang@intel.com,
yang.zhang.wz@gmail.com, riel@surriel.com, mst@redhat.com,
dodgen@google.com, konrad.wilk@oracle.com, dhildenb@redhat.com,
aarcange@redhat.com, alexander.duyck@gmail.com
Subject: Re: [RFC][Patch v10 1/2] mm: page_hinting: core infrastructure
Date: Fri, 14 Jun 2019 09:24:55 +0200 [thread overview]
Message-ID: <c95b0419-85bb-2210-cd90-732447de8345@redhat.com> (raw)
In-Reply-To: <20190603170306.49099-2-nitesh@redhat.com>
On 03.06.19 19:03, Nitesh Narayan Lal wrote:
> This patch introduces the core infrastructure for free page hinting in
> virtual environments. It enables the kernel to track the free pages which
> can be reported to its hypervisor so that the hypervisor could
> free and reuse that memory as per its requirement.
>
> While the pages are getting processed in the hypervisor (e.g.,
> via MADV_FREE), the guest must not use them, otherwise, data loss
> would be possible. To avoid such a situation, these pages are
> temporarily removed from the buddy. The amount of pages removed
> temporarily from the buddy is governed by the backend(virtio-balloon
> in our case).
>
> To efficiently identify free pages that can to be hinted to the
> hypervisor, bitmaps in a coarse granularity are used. Only fairly big
> chunks are reported to the hypervisor - especially, to not break up THP
> in the hypervisor - "MAX_ORDER - 2" on x86, and to save space. The bits
> in the bitmap are an indication whether a page *might* be free, not a
> guarantee. A new hook after buddy merging sets the bits.
>
> Bitmaps are stored per zone, protected by the zone lock. A workqueue
> asynchronously processes the bitmaps, trying to isolate and report pages
> that are still free. The backend (virtio-balloon) is responsible for
> reporting these batched pages to the host synchronously. Once reporting/
> freeing is complete, isolated pages are returned back to the buddy.
>
> There are still various things to look into (e.g., memory hotplug, more
> efficient locking, possible races when disabling).
>
> Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
> ---
> drivers/virtio/Kconfig | 1 +
> include/linux/page_hinting.h | 46 +++++++
> mm/Kconfig | 6 +
> mm/Makefile | 2 +
> mm/page_alloc.c | 17 +--
> mm/page_hinting.c | 236 +++++++++++++++++++++++++++++++++++
> 6 files changed, 301 insertions(+), 7 deletions(-)
> create mode 100644 include/linux/page_hinting.h
> create mode 100644 mm/page_hinting.c
>
> diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
> index 35897649c24f..5a96b7a2ed1e 100644
> --- a/drivers/virtio/Kconfig
> +++ b/drivers/virtio/Kconfig
> @@ -46,6 +46,7 @@ config VIRTIO_BALLOON
> tristate "Virtio balloon driver"
> depends on VIRTIO
> select MEMORY_BALLOON
> + select PAGE_HINTING
> ---help---
> This driver supports increasing and decreasing the amount
> of memory within a KVM guest.
BTW, this hunk belongs to the virtio-balloon patch.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2019-06-14 7:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-03 17:03 [RFC][Patch v10 0/2] mm: Support for page hinting Nitesh Narayan Lal
2019-06-03 17:03 ` [RFC][Patch v10 1/2] mm: page_hinting: core infrastructure Nitesh Narayan Lal
2019-06-03 19:04 ` Alexander Duyck
2019-06-04 12:55 ` Nitesh Narayan Lal
2019-06-04 15:14 ` Alexander Duyck
2019-06-04 16:07 ` Nitesh Narayan Lal
2019-06-04 16:25 ` Alexander Duyck
2019-06-04 16:42 ` Nitesh Narayan Lal
2019-06-04 17:12 ` Alexander Duyck
2019-06-03 19:57 ` David Hildenbrand
2019-06-04 13:16 ` Nitesh Narayan Lal
2019-06-14 7:24 ` David Hildenbrand [this message]
2019-06-03 17:03 ` [RFC][Patch v10 2/2] virtio-balloon: page_hinting: reporting to the host Nitesh Narayan Lal
2019-06-03 22:38 ` Alexander Duyck
2019-06-04 7:12 ` David Hildenbrand
2019-06-04 11:50 ` Nitesh Narayan Lal
2019-06-04 11:31 ` Nitesh Narayan Lal
2019-06-04 16:33 ` Alexander Duyck
2019-06-04 16:44 ` Nitesh Narayan Lal
2019-06-03 17:04 ` [QEMU PATCH] KVM: Support for page hinting Nitesh Narayan Lal
2019-06-03 18:34 ` Alexander Duyck
2019-06-03 18:37 ` Nitesh Narayan Lal
2019-06-03 18:45 ` Nitesh Narayan Lal
2019-06-04 16:41 ` Alexander Duyck
2019-06-04 16:48 ` Nitesh Narayan Lal
2019-06-03 18:04 ` [RFC][Patch v10 0/2] mm: " Michael S. Tsirkin
2019-06-03 18:38 ` Nitesh Narayan Lal
2019-06-11 12:19 ` Nitesh Narayan Lal
2019-06-11 15:00 ` Alexander Duyck
2019-06-25 14:48 ` Nitesh Narayan Lal
2019-06-25 17:10 ` Alexander Duyck
2019-06-25 17:31 ` Nitesh Narayan Lal
2019-06-28 18:25 ` Alexander Duyck
2019-06-28 19:13 ` Nitesh Narayan Lal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c95b0419-85bb-2210-cd90-732447de8345@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=dhildenb@redhat.com \
--cc=dodgen@google.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.com \
--cc=nitesh@redhat.com \
--cc=pagupta@redhat.com \
--cc=pbonzini@redhat.com \
--cc=riel@surriel.com \
--cc=wei.w.wang@intel.com \
--cc=yang.zhang.wz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).