From: Wei Wang <wei.w.wang@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org,
pbonzini@redhat.com, liliang.opensource@gmail.com,
yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com,
riel@redhat.com
Subject: Re: [virtio-dev] Re: [PATCH v25 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
Date: Fri, 26 Jan 2018 09:40:44 +0800 [thread overview]
Message-ID: <5A6A871C.6040408@intel.com> (raw)
In-Reply-To: <20180125154708-mutt-send-email-mst@kernel.org>
On 01/25/2018 09:49 PM, Michael S. Tsirkin wrote:
> On Thu, Jan 25, 2018 at 05:14:06PM +0800, Wei Wang wrote:
>> +
>> +static void report_free_page_func(struct work_struct *work)
>> +{
>> + struct virtio_balloon *vb;
>> + int ret;
>> +
>> + vb = container_of(work, struct virtio_balloon, report_free_page_work);
>> +
>> + /* Start by sending the received cmd id to host with an outbuf */
>> + ret = send_cmd_id(vb, vb->cmd_id_received);
>> + if (unlikely(ret))
>> + goto err;
>> +
>> + ret = walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);
>> + if (unlikely(ret < 0))
>> + goto err;
>> +
>> + /* End by sending a stop id to host with an outbuf */
>> + ret = send_cmd_id(vb, VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID);
>> + if (likely(!ret))
>> + return;
>> +err:
>> + dev_err(&vb->vdev->dev, "%s failure: free page vq is broken\n",
>> + __func__);
>> +}
>> +
> So that's very simple, but it only works well if the whole
> free list fits in the queue or host processes the queue faster
> than the guest. What if it doesn't?
This is the case that the virtqueue gets full, and I think we've agreed
that this is an optimization feature and losing some hints to report
isn't important, right?
Actually, in the tests, there is no chance to see the ring is full. If
we check the host patches that were shared before, the device side
operation is quite simple, it just clears the related bits from the
bitmap, and then continues to take entries from the virtqueue till the
virtqueue gets empty.
> If we had restartability you could just drop the lock
> and wait for a vq interrupt to make more progress, which
> would be better I think.
>
Restartability means that caller needs to record the state where it was
when it stopped last time. The controversy is that the free list is not
static once the lock is dropped, so everything is dynamically changing,
including the state that was recorded. The method we are using is more
prudent, IMHO. How about taking the fundamental solution, and seek to
improve incrementally in the future?
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>
next prev parent reply other threads:[~2018-01-26 1:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 9:14 [PATCH v25 0/2] Virtio-balloon: support free page reporting Wei Wang
2018-01-25 9:14 ` [PATCH v25 1/2] mm: support reporting free page blocks Wei Wang
2018-01-25 13:46 ` Michael S. Tsirkin
2018-01-25 9:14 ` [PATCH v25 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT Wei Wang
2018-01-25 13:49 ` Michael S. Tsirkin
2018-01-26 1:40 ` Wei Wang [this message]
2018-01-26 2:42 ` [virtio-dev] " Michael S. Tsirkin
2018-01-26 3:31 ` Wei Wang
2018-01-26 13:35 ` Tetsuo Handa
2018-01-30 23:44 ` Michael S. Tsirkin
2018-02-01 9:43 ` Wei Wang
2018-02-01 16:03 ` Michael S. Tsirkin
2018-02-01 19:15 ` [PATCH v25 0/2] Virtio-balloon: support free page reporting Michael S. Tsirkin
2018-02-02 12:48 ` 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=5A6A871C.6040408@intel.com \
--to=wei.w.wang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=liliang.opensource@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=nilal@redhat.com \
--cc=pbonzini@redhat.com \
--cc=quan.xu0@gmail.com \
--cc=riel@redhat.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=yang.zhang.wz@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).