Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1343917
| From | Jason Wang <jasowang@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V3 1/3] vhost: introduce vhost_has_work() |
| Date | 2016-02-26 09:50 +0100 |
| Message-ID | <r6mg3-tV-15@gated-at.bofh.it> (permalink) |
| References | <r6mg3-tV-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/vhost/vhost.c | 7 +++++++
drivers/vhost/vhost.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ad2146a..90ac092 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -245,6 +245,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);
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index d3f7674..43284ad 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -37,6 +37,7 @@ struct vhost_poll {
void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+bool vhost_has_work(struct vhost_dev *dev);
void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
unsigned long mask, struct vhost_dev *dev);
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V3 0/3] basic busy polling support for vhost_net Jason Wang <jasowang@redhat.com> - 2016-02-26 09:50 +0100
[PATCH V3 1/3] vhost: introduce vhost_has_work() Jason Wang <jasowang@redhat.com> - 2016-02-26 09:50 +0100
Re: [PATCH V3 0/3] basic busy polling support for vhost_net David Miller <davem@davemloft.net> - 2016-02-26 17:50 +0100
Re: [PATCH V3 0/3] basic busy polling support for vhost_net "Michael S. Tsirkin" <mst@redhat.com> - 2016-02-28 10:20 +0100
csiph-web