All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	Liang Li <liang.z.li@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Amit Shah <amit.shah@redhat.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Liang Li <liliang324@gmail.com>
Subject: Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
Date: Sat, 11 Mar 2017 19:59:31 +0800	[thread overview]
Message-ID: <58C3E6A3.1000000@intel.com> (raw)
In-Reply-To: <20170310171143.GA16328@bombadil.infradead.org>

On 03/11/2017 01:11 AM, Matthew Wilcox wrote:
> On Fri, Mar 10, 2017 at 05:58:28PM +0200, Michael S. Tsirkin wrote:
>> One of the issues of current balloon is the 4k page size
>> assumption. For example if you free a huge page you
>> have to split it up and pass 4k chunks to host.
>> Quite often host can't free these 4k chunks at all (e.g.
>> when it's using huge tlb fs).
>> It's even sillier for architectures with base page size >4k.
> I completely agree with you that we should be able to pass a hugepage
> as a single chunk.  Also we shouldn't assume that host and guest have
> the same page size.  I think we can come up with a scheme that actually
> lets us encode that into a 64-bit word, something like this:
>
> bit 0 clear => bits 1-11 encode a page count, bits 12-63 encode a PFN, page size 4k.
> bit 0 set, bit 1 clear => bits 2-12 encode a page count, bits 13-63 encode a PFN, page size 8k
> bits 0+1 set, bit 2 clear => bits 3-13 for page count, bits 14-63 for PFN, page size 16k.
> bits 0-2 set, bit 3 clear => bits 4-14 for page count, bits 15-63 for PFN, page size 32k
> bits 0-3 set, bit 4 clear => bits 5-15 for page count, bits 16-63 for PFN, page size 64k
>
> That means we can always pass 2048 pages (of whatever page size) in a single chunk.  And
> we support arbitrary power of two page sizes.  I suggest something like this:
>
> u64 page_to_chunk(struct page *page)
> {
> 	u64 chunk = page_to_pfn(page) << PAGE_SHIFT;
> 	chunk |= (1UL << compound_order(page)) - 1;
> }
>
> (note this is a single page of order N, so we leave the page count bits
> set to 0, meaning one page).
>

I'm thinking what if the guest needs to transfer these much physically 
continuous
memory to host: 1GB+2MB+64KB+32KB+16KB+4KB.
Is it going to use Six 64-bit chunks? Would it be simpler if we just
use the 128-bit chunk format (we can drop the previous normal 64-bit 
format)?

Best,
Wei

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Wei Wang <wei.w.wang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	Liang Li <liang.z.li@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Amit Shah <amit.shah@redhat.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Liang Li <liliang324@gmail.com>
Subject: Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
Date: Sat, 11 Mar 2017 19:59:31 +0800	[thread overview]
Message-ID: <58C3E6A3.1000000@intel.com> (raw)
In-Reply-To: <20170310171143.GA16328@bombadil.infradead.org>

On 03/11/2017 01:11 AM, Matthew Wilcox wrote:
> On Fri, Mar 10, 2017 at 05:58:28PM +0200, Michael S. Tsirkin wrote:
>> One of the issues of current balloon is the 4k page size
>> assumption. For example if you free a huge page you
>> have to split it up and pass 4k chunks to host.
>> Quite often host can't free these 4k chunks at all (e.g.
>> when it's using huge tlb fs).
>> It's even sillier for architectures with base page size >4k.
> I completely agree with you that we should be able to pass a hugepage
> as a single chunk.  Also we shouldn't assume that host and guest have
> the same page size.  I think we can come up with a scheme that actually
> lets us encode that into a 64-bit word, something like this:
>
> bit 0 clear => bits 1-11 encode a page count, bits 12-63 encode a PFN, page size 4k.
> bit 0 set, bit 1 clear => bits 2-12 encode a page count, bits 13-63 encode a PFN, page size 8k
> bits 0+1 set, bit 2 clear => bits 3-13 for page count, bits 14-63 for PFN, page size 16k.
> bits 0-2 set, bit 3 clear => bits 4-14 for page count, bits 15-63 for PFN, page size 32k
> bits 0-3 set, bit 4 clear => bits 5-15 for page count, bits 16-63 for PFN, page size 64k
>
> That means we can always pass 2048 pages (of whatever page size) in a single chunk.  And
> we support arbitrary power of two page sizes.  I suggest something like this:
>
> u64 page_to_chunk(struct page *page)
> {
> 	u64 chunk = page_to_pfn(page) << PAGE_SHIFT;
> 	chunk |= (1UL << compound_order(page)) - 1;
> }
>
> (note this is a single page of order N, so we leave the page count bits
> set to 0, meaning one page).
>

I'm thinking what if the guest needs to transfer these much physically 
continuous
memory to host: 1GB+2MB+64KB+32KB+16KB+4KB.
Is it going to use Six 64-bit chunks? Would it be simpler if we just
use the 128-bit chunk format (we can drop the previous normal 64-bit 
format)?

Best,
Wei

WARNING: multiple messages have this Message-ID (diff)
From: Wei Wang <wei.w.wang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	Liang Li <liang.z.li@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Amit Shah <amit.shah@redhat.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Liang Li <liliang324@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
Date: Sat, 11 Mar 2017 19:59:31 +0800	[thread overview]
Message-ID: <58C3E6A3.1000000@intel.com> (raw)
In-Reply-To: <20170310171143.GA16328@bombadil.infradead.org>

On 03/11/2017 01:11 AM, Matthew Wilcox wrote:
> On Fri, Mar 10, 2017 at 05:58:28PM +0200, Michael S. Tsirkin wrote:
>> One of the issues of current balloon is the 4k page size
>> assumption. For example if you free a huge page you
>> have to split it up and pass 4k chunks to host.
>> Quite often host can't free these 4k chunks at all (e.g.
>> when it's using huge tlb fs).
>> It's even sillier for architectures with base page size >4k.
> I completely agree with you that we should be able to pass a hugepage
> as a single chunk.  Also we shouldn't assume that host and guest have
> the same page size.  I think we can come up with a scheme that actually
> lets us encode that into a 64-bit word, something like this:
>
> bit 0 clear => bits 1-11 encode a page count, bits 12-63 encode a PFN, page size 4k.
> bit 0 set, bit 1 clear => bits 2-12 encode a page count, bits 13-63 encode a PFN, page size 8k
> bits 0+1 set, bit 2 clear => bits 3-13 for page count, bits 14-63 for PFN, page size 16k.
> bits 0-2 set, bit 3 clear => bits 4-14 for page count, bits 15-63 for PFN, page size 32k
> bits 0-3 set, bit 4 clear => bits 5-15 for page count, bits 16-63 for PFN, page size 64k
>
> That means we can always pass 2048 pages (of whatever page size) in a single chunk.  And
> we support arbitrary power of two page sizes.  I suggest something like this:
>
> u64 page_to_chunk(struct page *page)
> {
> 	u64 chunk = page_to_pfn(page) << PAGE_SHIFT;
> 	chunk |= (1UL << compound_order(page)) - 1;
> }
>
> (note this is a single page of order N, so we leave the page count bits
> set to 0, meaning one page).
>

I'm thinking what if the guest needs to transfer these much physically 
continuous
memory to host: 1GB+2MB+64KB+32KB+16KB+4KB.
Is it going to use Six 64-bit chunks? Would it be simpler if we just
use the 128-bit chunk format (we can drop the previous normal 64-bit 
format)?

Best,
Wei

  parent reply	other threads:[~2017-03-11 11:59 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  5:40 [PATCH v7 kernel 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration Wei Wang
2017-03-03  5:40 ` [Qemu-devel] " Wei Wang
2017-03-03  5:40 ` Wei Wang
2017-03-03  5:40 ` [PATCH v7 kernel 1/5] virtio-balloon: rework deflate to add page to a list Wei Wang
2017-03-03  5:40   ` [Qemu-devel] " Wei Wang
2017-03-03  5:40   ` Wei Wang
2017-03-03  5:40 ` Wei Wang
2017-03-03  5:40 ` [PATCH v7 kernel 2/5] virtio-balloon: VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang
2017-03-03  5:40 ` Wei Wang
2017-03-03  5:40   ` [Qemu-devel] " Wei Wang
2017-03-03  5:40   ` Wei Wang
2017-03-08  4:01   ` Michael S. Tsirkin
2017-03-08  4:01   ` Michael S. Tsirkin
2017-03-08  4:01     ` [Qemu-devel] " Michael S. Tsirkin
2017-03-08  4:01     ` Michael S. Tsirkin
2017-03-09  7:12     ` Wei Wang
2017-03-09  7:12     ` Wei Wang
2017-03-09  7:12       ` [Qemu-devel] " Wei Wang
2017-03-09  7:12       ` Wei Wang
2017-03-03  5:40 ` [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER Wei Wang
2017-03-03  5:40   ` [Qemu-devel] " Wei Wang
2017-03-03  5:40   ` Wei Wang
2017-03-08  4:01   ` Michael S. Tsirkin
2017-03-08  4:01     ` [Qemu-devel] " Michael S. Tsirkin
2017-03-08  4:01     ` Michael S. Tsirkin
2017-03-10 10:02     ` [virtio-dev] " Wei Wang
2017-03-10 10:02     ` Wei Wang
2017-03-10 10:02       ` [Qemu-devel] [virtio-dev] " Wei Wang
2017-03-10 10:02       ` Wei Wang
2017-03-10 10:02       ` Wei Wang
2017-03-10 13:26       ` David Hildenbrand
2017-03-10 13:26         ` [Qemu-devel] " David Hildenbrand
2017-03-10 13:26         ` David Hildenbrand
2017-03-10 13:26         ` David Hildenbrand
2017-03-10 15:37       ` Michael S. Tsirkin
2017-03-10 15:37         ` [Qemu-devel] " Michael S. Tsirkin
2017-03-10 15:37         ` Michael S. Tsirkin
2017-03-10 15:37       ` Michael S. Tsirkin
2017-03-08  4:01   ` Michael S. Tsirkin
2017-03-09 14:14   ` Matthew Wilcox
2017-03-09 14:14   ` Matthew Wilcox
2017-03-09 14:14     ` [Qemu-devel] " Matthew Wilcox
2017-03-09 14:14     ` Matthew Wilcox
2017-03-10 11:37     ` Wei Wang
2017-03-10 11:37     ` Wei Wang
2017-03-10 11:37       ` [Qemu-devel] " Wei Wang
2017-03-10 11:37       ` Wei Wang
2017-03-10 15:58       ` Michael S. Tsirkin
2017-03-10 15:58       ` Michael S. Tsirkin
2017-03-10 15:58         ` [Qemu-devel] " Michael S. Tsirkin
2017-03-10 15:58         ` Michael S. Tsirkin
2017-03-10 17:11         ` Matthew Wilcox
2017-03-10 17:11           ` [Qemu-devel] " Matthew Wilcox
2017-03-10 17:11           ` Matthew Wilcox
2017-03-10 19:10           ` Michael S. Tsirkin
2017-03-10 19:10           ` Michael S. Tsirkin
2017-03-10 19:10             ` [Qemu-devel] " Michael S. Tsirkin
2017-03-10 19:10             ` Michael S. Tsirkin
2017-03-10 21:18             ` Matthew Wilcox
2017-03-10 21:18               ` [Qemu-devel] " Matthew Wilcox
2017-03-10 21:18               ` Matthew Wilcox
2017-03-10 21:18             ` Matthew Wilcox
2017-03-10 19:35           ` Michael S. Tsirkin
2017-03-10 19:35             ` [Qemu-devel] " Michael S. Tsirkin
2017-03-10 19:35             ` Michael S. Tsirkin
2017-03-10 21:25             ` Matthew Wilcox
2017-03-10 21:25             ` Matthew Wilcox
2017-03-10 21:25               ` [Qemu-devel] " Matthew Wilcox
2017-03-10 21:25               ` Matthew Wilcox
2017-03-12  0:05               ` Michael S. Tsirkin
2017-03-12  0:05               ` Michael S. Tsirkin
2017-03-12  0:05                 ` [Qemu-devel] " Michael S. Tsirkin
2017-03-12  0:05                 ` Michael S. Tsirkin
2017-03-10 19:35           ` Michael S. Tsirkin
2017-03-11 11:59           ` Wei Wang [this message]
2017-03-11 11:59             ` [Qemu-devel] " Wei Wang
2017-03-11 11:59             ` Wei Wang
2017-03-11 14:09             ` Matthew Wilcox
2017-03-11 14:09               ` [Qemu-devel] " Matthew Wilcox
2017-03-11 14:09               ` Matthew Wilcox
2017-03-12  1:59               ` Wang, Wei W
2017-03-12  1:59                 ` [Qemu-devel] " Wang, Wei W
2017-03-12  1:59                 ` Wang, Wei W
2017-03-12  4:04                 ` Michael S. Tsirkin
2017-03-12  4:04                   ` [Qemu-devel] " Michael S. Tsirkin
2017-03-12  4:04                   ` Michael S. Tsirkin
2017-03-13 12:41                   ` Wang, Wei W
2017-03-13 12:41                     ` [Qemu-devel] " Wang, Wei W
2017-03-13 12:41                     ` Wang, Wei W
2017-03-13 12:41                     ` Wang, Wei W
2017-03-12  4:04                 ` Michael S. Tsirkin
2017-03-12  1:59               ` Wang, Wei W
2017-03-11 14:09             ` Matthew Wilcox
2017-03-12  0:07             ` Michael S. Tsirkin
2017-03-12  0:07             ` Michael S. Tsirkin
2017-03-12  0:07               ` [Qemu-devel] " Michael S. Tsirkin
2017-03-12  0:07               ` Michael S. Tsirkin
2017-03-11 11:59           ` Wei Wang
2017-03-10 17:11         ` Matthew Wilcox
2017-03-03  5:40 ` Wei Wang
2017-03-03  5:40 ` [PATCH v7 kernel 4/5] virtio-balloon: define flags and head for host request vq Wei Wang
2017-03-03  5:40 ` Wei Wang
2017-03-03  5:40   ` [Qemu-devel] " Wei Wang
2017-03-03  5:40   ` Wei Wang
2017-03-08  4:02   ` Michael S. Tsirkin
2017-03-08  4:02     ` [Qemu-devel] " Michael S. Tsirkin
2017-03-08  4:02     ` Michael S. Tsirkin
2017-03-08  4:02   ` Michael S. Tsirkin
2017-03-03  5:40 ` [PATCH v7 kernel 5/5] This patch contains two parts: Wei Wang
2017-03-03  5:40   ` [Qemu-devel] " Wei Wang
2017-03-03  5:40   ` Wei Wang
2017-03-06 13:23   ` David Hildenbrand
2017-03-06 13:23     ` [Qemu-devel] " David Hildenbrand
2017-03-06 13:23     ` David Hildenbrand
2017-03-09  7:04     ` Wei Wang
2017-03-09  7:04     ` Wei Wang
2017-03-09  7:04       ` [Qemu-devel] " Wei Wang
2017-03-09  7:04       ` Wei Wang
2017-03-06 13:23   ` David Hildenbrand
2017-03-03  5:40 ` Wei Wang

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=58C3E6A3.1000000@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=aarcange@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=liang.z.li@intel.com \
    --cc=liliang324@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.