summaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_ring.h
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@redhat.com>2015-04-13 21:03:49 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-04-13 21:04:16 +0930
commit9e1a27ea42691429e31f158cce6fc61bc79bb2e9 (patch)
tree46b42dc8ad0ee34fafcf6d7228e51066a550f184 /include/linux/virtio_ring.h
parenta8557d32fe90a91d70dbbf57a034ad0c660ce237 (diff)
downloadlinux-9e1a27ea42691429e31f158cce6fc61bc79bb2e9.tar.gz
linux-9e1a27ea42691429e31f158cce6fc61bc79bb2e9.tar.bz2
linux-9e1a27ea42691429e31f158cce6fc61bc79bb2e9.zip
virtio_ring: Update weak barriers to use dma_wmb/rmb
This change makes it so that instead of using smp_wmb/rmb which varies depending on the kernel configuration we can can use dma_wmb/rmb which for most architectures should be equal to or slightly more strict than smp_wmb/rmb. The advantage to this is that these barriers are available to uniprocessor builds as well so the performance should improve under such a configuration. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio_ring.h')
-rw-r--r--include/linux/virtio_ring.h23
1 files changed, 4 insertions, 19 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 67e06fe18c03..8e50888a6d59 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -21,19 +21,20 @@
* actually quite cheap.
*/
-#ifdef CONFIG_SMP
static inline void virtio_mb(bool weak_barriers)
{
+#ifdef CONFIG_SMP
if (weak_barriers)
smp_mb();
else
+#endif
mb();
}
static inline void virtio_rmb(bool weak_barriers)
{
if (weak_barriers)
- smp_rmb();
+ dma_rmb();
else
rmb();
}
@@ -41,26 +42,10 @@ static inline void virtio_rmb(bool weak_barriers)
static inline void virtio_wmb(bool weak_barriers)
{
if (weak_barriers)
- smp_wmb();
+ dma_wmb();
else
wmb();
}
-#else
-static inline void virtio_mb(bool weak_barriers)
-{
- mb();
-}
-
-static inline void virtio_rmb(bool weak_barriers)
-{
- rmb();
-}
-
-static inline void virtio_wmb(bool weak_barriers)
-{
- wmb();
-}
-#endif
struct virtio_device;
struct virtqueue;