drivers/virtio/virtio_balloon.c | 615 +++++++++++++++++++++++++++++++++--- include/linux/mm.h | 3 + include/uapi/linux/virtio_balloon.h | 21 ++ mm/mmzone.c | 2 + mm/page_alloc.c | 87 +++++ 5 files changed, 678 insertions(+), 50 deletions(-)
This patch series implements two optimizations: 1) transfer pages in chuncks between the guest and host; 2) transfer the guest unused pages to the host so that they can be skipped to migrate in live migration. Changes: v8->v9: 1) Split the two new features, VIRTIO_BALLOON_F_BALLOON_CHUNKS and VIRTIO_BALLOON_F_MISC_VQ, which were mixed together in the previous implementation; 2) Simpler function to get the free page block. v7->v8: 1) Use only one chunk format, instead of two. 2) re-write the virtio-balloon implementation patch. 3) commit changes 4) patch re-org Liang Li (1): virtio-balloon: deflate via a page list Wei Wang (4): virtio-balloon: VIRTIO_BALLOON_F_BALLOON_CHUNKS mm: function to offer a page block on the free list mm: export symbol of next_zone and first_online_pgdat virtio-balloon: VIRTIO_BALLOON_F_MISC_VQ drivers/virtio/virtio_balloon.c | 615 +++++++++++++++++++++++++++++++++--- include/linux/mm.h | 3 + include/uapi/linux/virtio_balloon.h | 21 ++ mm/mmzone.c | 2 + mm/page_alloc.c | 87 +++++ 5 files changed, 678 insertions(+), 50 deletions(-) -- 2.7.4
On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: > 2) transfer the guest unused pages to the host so that they > can be skipped to migrate in live migration. I don't understand this second bit. You leave the pages on the free list, and tell the host they're free. What's preventing somebody else from allocating them and using them for something? Is the guest semi-frozen at this point with just enough of it running to ask the balloon driver to do things?
On Thu, Apr 13, 2017 at 01:44:11PM -0700, Matthew Wilcox wrote: > On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: > > 2) transfer the guest unused pages to the host so that they > > can be skipped to migrate in live migration. > > I don't understand this second bit. You leave the pages on the free list, > and tell the host they're free. What's preventing somebody else from > allocating them and using them for something? Is the guest semi-frozen > at this point with just enough of it running to ask the balloon driver > to do things? There's missing documentation here. The way things actually work is host sends to guest a request for unused pages and then write-protects all memory. So guest isn't frozen but any changes will be detected by host.
On 04/14/2017 09:50 AM, Michael S. Tsirkin wrote: > On Thu, Apr 13, 2017 at 01:44:11PM -0700, Matthew Wilcox wrote: >> On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: >>> 2) transfer the guest unused pages to the host so that they >>> can be skipped to migrate in live migration. >> I don't understand this second bit. You leave the pages on the free list, >> and tell the host they're free. What's preventing somebody else from >> allocating them and using them for something? Is the guest semi-frozen >> at this point with just enough of it running to ask the balloon driver >> to do things? > There's missing documentation here. > > The way things actually work is host sends to guest > a request for unused pages and then write-protects all memory. > > So guest isn't frozen but any changes will be detected by host. > Probably it's better to say " transfer the info about the guest unused pages to the host so that the host gets a chance to skip the transfer of the unused pages during live migration". Best, Wei
On Fri, Apr 14, 2017 at 10:28:32AM +0800, Wei Wang wrote: > On 04/14/2017 09:50 AM, Michael S. Tsirkin wrote: > > On Thu, Apr 13, 2017 at 01:44:11PM -0700, Matthew Wilcox wrote: > > > On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: > > > > 2) transfer the guest unused pages to the host so that they > > > > can be skipped to migrate in live migration. > > > I don't understand this second bit. You leave the pages on the free list, > > > and tell the host they're free. What's preventing somebody else from > > > allocating them and using them for something? Is the guest semi-frozen > > > at this point with just enough of it running to ask the balloon driver > > > to do things? > > There's missing documentation here. > > > > The way things actually work is host sends to guest > > a request for unused pages and then write-protects all memory. > > > > So guest isn't frozen but any changes will be detected by host. > > > > Probably it's better to say " transfer the info about the guest unused pages > to the host so that the host gets a chance to skip the transfer of the > unused > pages during live migration". > > Best, > Wei IMHO this would not be helpful. Most people don't know how does migration work, even if they did this isn't tied to migration in any way. It just makes people go "oh it's some virtualization mumbo jumbo". We want people to be able to review and for that interfaces need to be separate from the implementation. IOW we must document what the interface promises not how it's used. The promise is that pages have been unused at some time between when host sent command and when guest completed it. Host uses that by tracking memory changes and then discarding changes made to pages it gets from guest before it sent the command. Say that and drop all mention of transfer, migration etc. -- MST
On Fri, Apr 14, 2017 at 04:50:48AM +0300, Michael S. Tsirkin wrote: > On Thu, Apr 13, 2017 at 01:44:11PM -0700, Matthew Wilcox wrote: > > On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: > > > 2) transfer the guest unused pages to the host so that they > > > can be skipped to migrate in live migration. > > > > I don't understand this second bit. You leave the pages on the free list, > > and tell the host they're free. What's preventing somebody else from > > allocating them and using them for something? Is the guest semi-frozen > > at this point with just enough of it running to ask the balloon driver > > to do things? > > There's missing documentation here. > > The way things actually work is host sends to guest > a request for unused pages and then write-protects all memory. ... hopefully you mean "write protects all memory, then sends a request for unused pages", otherwise there's a race condition. And I see the utility of this, but does this functionality belong in the balloon driver? It seems like it's something you might want even if you don't have the balloon driver loaded. Or something you might not want if you do have the balloon driver loaded.
On Fri, Apr 14, 2017 at 02:47:40AM -0700, Matthew Wilcox wrote: > On Fri, Apr 14, 2017 at 04:50:48AM +0300, Michael S. Tsirkin wrote: > > On Thu, Apr 13, 2017 at 01:44:11PM -0700, Matthew Wilcox wrote: > > > On Thu, Apr 13, 2017 at 05:35:03PM +0800, Wei Wang wrote: > > > > 2) transfer the guest unused pages to the host so that they > > > > can be skipped to migrate in live migration. > > > > > > I don't understand this second bit. You leave the pages on the free list, > > > and tell the host they're free. What's preventing somebody else from > > > allocating them and using them for something? Is the guest semi-frozen > > > at this point with just enough of it running to ask the balloon driver > > > to do things? > > > > There's missing documentation here. > > > > The way things actually work is host sends to guest > > a request for unused pages and then write-protects all memory. > > ... hopefully you mean "write protects all memory, then sends a request > for unused pages", otherwise there's a race condition. Exactly. > And I see the utility of this, but does this functionality belong in > the balloon driver? We have historically put all kind of memory-related functionality in the balloon device. Consider for example memory statistics - seems related conceptually. See patches 1-2: the new mechanism for reporting lists of pages seems to be benefitial for both which seems to indicate using the balloon for this is a good idea. > It seems like it's something you might want even if you don't have the > balloon driver loaded. Or something you might not want if you do have > the balloon driver loaded. Most of balloon functionality is kind of loosely coupled. Yes we could split it up but I'm not sure what would this buy us. What do you have in mind? -- MST
© 2016 - 2024 Red Hat, Inc.