Thread (7 messages) 7 messages, 3 authors, 2015-10-23

Re: [PATCH net-next RFC 1/2] vhost: introduce vhost_has_work()

flat view

From: Jason Wang <hidden>
Date: 2015-10-23 07:11:03
Also in: kvm, lkml, netdev


On 10/22/2015 04:38 PM, Michael S. Tsirkin wrote:
On Thu, Oct 22, 2015 at 01:27:28AM -0400, Jason Wang wrote:
quoted
quoted
This path introduces a helper which can give a hint for whether or not
there's a work queued in the work list.

Signed-off-by: Jason Wang <redacted>
---
 drivers/vhost/vhost.c | 6 ++++++
 drivers/vhost/vhost.h | 1 +
 2 files changed, 7 insertions(+)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index eec2f11..d42d11e 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -245,6 +245,12 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 }
 EXPORT_SYMBOL_GPL(vhost_work_queue);
 
+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);
This doesn't take a lock so it's unreliable.
I think it's ok in this case since it's just
an optimization - but pls document this.
Ok, will do.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help