Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597595

Re: [virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER

From David Hildenbrand <david@redhat.com>
Newsgroups linux.kernel
Subject Re: [virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
Date 2017-03-10 14:30 +0100
Message-ID <tjsMj-4Ar-71@gated-at.bofh.it> (permalink)
References <tgOgi-4ZL-5@gated-at.bofh.it> <tgOgi-4ZL-11@gated-at.bofh.it> <tiCNH-237-13@gated-at.bofh.it> <tjpEK-2rf-19@gated-at.bofh.it>
Organization Red Hat GmbH

Show all headers | View raw


Am 10.03.2017 um 11:02 schrieb Wei Wang:
> On 03/08/2017 12:01 PM, Michael S. Tsirkin wrote:
>> On Fri, Mar 03, 2017 at 01:40:28PM +0800, Wei Wang wrote:
>>> From: Liang Li <liang.z.li@intel.com>
>>>
>>> The implementation of the current virtio-balloon is not very
>>> efficient, because the pages are transferred to the host one by one.
>>> Here is the breakdown of the time in percentage spent on each
>>> step of the balloon inflating process (inflating 7GB of an 8GB
>>> idle guest).
>>>
>>> 1) allocating pages (6.5%)
>>> 2) sending PFNs to host (68.3%)
>>> 3) address translation (6.1%)
>>> 4) madvise (19%)
>>>
>>> It takes about 4126ms for the inflating process to complete.
>>> The above profiling shows that the bottlenecks are stage 2)
>>> and stage 4).
>>>
>>> This patch optimizes step 2) by transfering pages to the host in
>>> chunks. A chunk consists of guest physically continuous pages, and
>>> it is offered to the host via a base PFN (i.e. the start PFN of
>>> those physically continuous pages) and the size (i.e. the total
>>> number of the pages). A normal chunk is formated as below:
>>> -----------------------------------------------
>>> |  Base (52 bit)               | Size (12 bit)|
>>> -----------------------------------------------
>>> For large size chunks, an extended chunk format is used:
>>> -----------------------------------------------
>>> |                 Base (64 bit)               |
>>> -----------------------------------------------
>>> -----------------------------------------------
>>> |                 Size (64 bit)               |
>>> -----------------------------------------------
>>>
>>> By doing so, step 4) can also be optimized by doing address
>>> translation and madvise() in chunks rather than page by page.
>>>
>>> This optimization requires the negotation of a new feature bit,
>>> VIRTIO_BALLOON_F_CHUNK_TRANSFER.
>>>
>>> With this new feature, the above ballooning process takes ~590ms
>>> resulting in an improvement of ~85%.
>>>
>>> TODO: optimize stage 1) by allocating/freeing a chunk of pages
>>> instead of a single page each time.
>>>
>>> Signed-off-by: Liang Li <liang.z.li@intel.com>
>>> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
>>> Suggested-by: Michael S. Tsirkin <mst@redhat.com>
>>> Cc: Michael S. Tsirkin <mst@redhat.com>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>>> Cc: Amit Shah <amit.shah@redhat.com>
>>> Cc: Dave Hansen <dave.hansen@intel.com>
>>> Cc: Andrea Arcangeli <aarcange@redhat.com>
>>> Cc: David Hildenbrand <david@redhat.com>
>>> Cc: Liang Li <liliang324@gmail.com>
>>> Cc: Wei Wang <wei.w.wang@intel.com>
>> Does this pass sparse? I see some endian-ness issues here.
> 
> "pass sparse"- what does that mean?
> I didn't see any complaints from "make" on my machine.

https://kernel.org/doc/html/latest/dev-tools/sparse.html

Static code analysis. You have to run it explicitly.

-- 
Thanks,

David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang <wei.w.wang@intel.com> - 2017-03-03 06:50 +0100
  Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-08 07:00 +0100
    Re: [virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation  of VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang <wei.w.wang@intel.com> - 2017-03-10 11:10 +0100
      Re: [virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon:  implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER David Hildenbrand <david@redhat.com> - 2017-03-10 14:30 +0100
      Re: [virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon:  implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-10 16:40 +0100
  Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER Matthew Wilcox <willy@infradead.org> - 2017-03-09 15:20 +0100
    Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang <wei.w.wang@intel.com> - 2017-03-10 12:40 +0100
      Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-10 17:00 +0100
        Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER Matthew Wilcox <willy@infradead.org> - 2017-03-10 18:20 +0100
          Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-10 20:20 +0100
            Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER Matthew Wilcox <willy@infradead.org> - 2017-03-10 22:20 +0100
          Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-10 20:40 +0100
            Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER Matthew Wilcox <willy@infradead.org> - 2017-03-10 22:30 +0100
              Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-12 01:10 +0100
          Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang <wei.w.wang@intel.com> - 2017-03-11 13:00 +0100
            Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER Matthew Wilcox <willy@infradead.org> - 2017-03-11 15:20 +0100
              RE: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Wang, Wei W" <wei.w.wang@intel.com> - 2017-03-12 03:10 +0100
                Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-12 05:10 +0100
                RE: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Wang, Wei W" <wei.w.wang@intel.com> - 2017-03-13 13:50 +0100
            Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of  VIRTIO_BALLOON_F_CHUNK_TRANSFER "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-12 01:10 +0100

csiph-web