On Thu, Aug 17, 2017 at 11:26:56AM +0800, Wei Wang wrote:
Add a new vq to report hints of guest free pages to the host.Please add some text here explaining the report_free_page_signal
thing.
I also really think we need some kind of ID in the
buffer to do a handshake. whenever id changes you
add another outbuf.
+retry:what if there's another error?
+ ret = virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL);
+ virtqueue_kick(vq);
+ if (unlikely(ret == -ENOSPC)) {
+ wait_event(vb->acked, virtqueue_get_buf(vq, &len));what is this trickery doing? needs more comments or
+ goto retry;
+ }
a simplification.
+}That's a lot of work here. And system_wq documentation says:
+
+static void report_free_page(struct work_struct *work)
+{
+ struct virtio_balloon *vb;
+
+ vb = container_of(work, struct virtio_balloon, report_free_page_work);
+ walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);
*
* system_wq is the one used by schedule[_delayed]_work[_on]().
* Multi-CPU multi-threaded. There are users which expect relatively
* short queue flush time. Don't queue works which can run for too
* long.
You might want to create your own wq, maybe even with WQ_CPU_INTENSIVE.
+ report_free_page_completion(vb);So first you get list of pages, then an outbuf telling you
what they are in end of. I think it's backwards.
Add an outbuf first followed by inbufs that tell you
what they are.