summaryrefslogtreecommitdiffstats
path: root/drivers/vhost/vhost.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2016-03-04 12:24:51 +0100
committerMichael S. Tsirkin <mst@redhat.com>2016-03-11 01:18:45 +0100
commit526d3e7ff515582eaf7cf5d9da2a11bf681204e6 (patch)
tree0f8cb97f616c8b09c1c8dd90530006581b26a3da /drivers/vhost/vhost.c
parentvirtio_balloon: Allow to resize and update the balloon stats in parallel (diff)
downloadlinux-526d3e7ff515582eaf7cf5d9da2a11bf681204e6.tar.xz
linux-526d3e7ff515582eaf7cf5d9da2a11bf681204e6.zip
vhost: introduce vhost_has_work()
This path introduces a helper which can give a hint for whether or not there's a work queued in the work list. This could be used for busy polling code to exit the busy loop. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r--drivers/vhost/vhost.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 328c54ab0154..596de212fe7e 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -263,6 +263,13 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
}
EXPORT_SYMBOL_GPL(vhost_work_queue);
+/* A lockless hint for busy polling code to exit the loop */
+bool vhost_has_work(struct vhost_dev *dev)
+{
+ return !list_empty(&dev->work_list);
+}
+EXPORT_SYMBOL_GPL(vhost_has_work);
+
void vhost_poll_queue(struct vhost_poll *poll)
{
vhost_work_queue(poll->dev, &poll->work);