Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2018-01-03 Thread Tetsuo Handa
Wei Wang wrote: > On 01/03/2018 10:29 AM, Tetsuo Handa wrote: > > Matthew Wilcox wrote: > >> The radix tree convention is objectively awful, which is why I'm working > >> to change it. Specifying the GFP flags at radix tree initialisation time > >> rather than allocation time leads to all kinds of

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2018-01-03 Thread Wei Wang
On 01/03/2018 10:29 AM, Tetsuo Handa wrote: Matthew Wilcox wrote: The radix tree convention is objectively awful, which is why I'm working to change it. Specifying the GFP flags at radix tree initialisation time rather than allocation time leads to all kinds of confusion. The preload API is a

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2018-01-02 Thread Tetsuo Handa
Matthew Wilcox wrote: > The radix tree convention is objectively awful, which is why I'm working > to change it. Specifying the GFP flags at radix tree initialisation time > rather than allocation time leads to all kinds of confusion. The preload > API is a pretty awful workaround, and it will go

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2018-01-02 Thread Matthew Wilcox
On Sun, Dec 24, 2017 at 03:42:02PM +0800, Wei Wang wrote: > On 12/24/2017 12:45 PM, Tetsuo Handa wrote: > > Matthew Wilcox wrote: > > > If you can't preload with anything better than that, I think that > > > xb_set_bit() should attempt an allocation with GFP_NOWAIT | __GFP_NOWARN, > > > and then yo

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-26 Thread Tetsuo Handa
Wei Wang wrote: > On 12/26/2017 06:38 PM, Tetsuo Handa wrote: > > Wei Wang wrote: > >> On 12/25/2017 10:51 PM, Tetsuo Handa wrote: > >>> Wei Wang wrote: > >>> > >> What we are doing here is to free the pages that were just allocated in > >> this round of inflating. Next round will be sometime later

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-26 Thread Wei Wang
On 12/26/2017 06:38 PM, Tetsuo Handa wrote: Wei Wang wrote: On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: What we are doing here is to free the pages that were just allocated in this round of inflating. Next round will be sometime later when the balloon work item gets its turn t

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-26 Thread Tetsuo Handa
Wei Wang wrote: > On 12/25/2017 10:51 PM, Tetsuo Handa wrote: > > Wei Wang wrote: > >> @@ -173,8 +292,15 @@ static unsigned fill_balloon(struct > >> virtio_balloon *vb, size_t num) > >> while ((page = balloon_page_pop(&pages))) { > >>balloon_page_enqueue(&vb->vb

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-25 Thread Wei Wang
On 12/25/2017 10:51 PM, Tetsuo Handa wrote: Wei Wang wrote: @@ -173,8 +292,15 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num) while ((page = balloon_page_pop(&pages))) { balloon_page_enqueue(&vb->vb_dev_info, page); +if (use_sg) { +i

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-25 Thread Tetsuo Handa
Wei Wang wrote: > @@ -173,8 +292,15 @@ static unsigned fill_balloon(struct > virtio_balloon *vb, size_t num) > while ((page = balloon_page_pop(&pages))) { > balloon_page_enqueue(&vb->vb_dev_info, page); > +if (use_sg) { > +if (xb_

Re: [virtio-dev] Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-24 Thread Wei Wang
On 12/24/2017 03:42 PM, Wei Wang wrote: On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: +unsigned long pfn = page_to_pfn(page); +int ret; + +*pfn_min = min(pfn, *pfn_min); +*pfn_max = max(pfn, *pfn_max); + +do { +if (xb_preload(GFP_NOWAIT | __GFP_NO

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-23 Thread Wei Wang
On 12/24/2017 12:45 PM, Tetsuo Handa wrote: Matthew Wilcox wrote: + unsigned long pfn = page_to_pfn(page); + int ret; + + *pfn_min = min(pfn, *pfn_min); + *pfn_max = max(pfn, *pfn_max); + + do { + if (xb_preload(GFP_NOWAIT | __GFP_NOWARN) < 0) +

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-23 Thread Tetsuo Handa
Matthew Wilcox wrote: > > + unsigned long pfn = page_to_pfn(page); > > + int ret; > > + > > + *pfn_min = min(pfn, *pfn_min); > > + *pfn_max = max(pfn, *pfn_max); > > + > > + do { > > + if (xb_preload(GFP_NOWAIT | __GFP_NOWARN) < 0) > > + return -ENOMEM; > > + >

Re: [PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-23 Thread Matthew Wilcox
On Tue, Dec 19, 2017 at 08:17:56PM +0800, Wei Wang wrote: > +/* > + * Send balloon pages in sgs to host. The balloon pages are recorded in the > + * page xbitmap. Each bit in the bitmap corresponds to a page of PAGE_SIZE. > + * The page xbitmap is searched for continuous "1" bits, which correspond

[PATCH v20 4/7] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-12-19 Thread Wei Wang
Add a new feature, VIRTIO_BALLOON_F_SG, which enables the transfer of balloon (i.e. inflated/deflated) pages using scatter-gather lists to the host. The implementation of the previous virtio-balloon is not very efficient, because the balloon pages are transferred to the host by one array each time