aboutsummaryrefslogtreecommitdiff
path: root/include/os/freebsd/spl
diff options
context:
space:
mode:
authorRichard Yao <richard.yao@alumni.stonybrook.edu>2022-09-13 23:59:33 +0000
committerGitHub <noreply@github.com>2022-09-13 23:59:33 +0000
commitcf66e7e594fc7063db8050f2b7c718ae3f94641b (patch)
tree8880e6d173a793b658f61e1c2ace06cc02b4c700 /include/os/freebsd/spl
parent8fdc229a9cb6c7f5ba6cd8dc3b40a3c1355f66c5 (diff)
downloadsrc-cf66e7e594fc7063db8050f2b7c718ae3f94641b.tar.gz
src-cf66e7e594fc7063db8050f2b7c718ae3f94641b.zip
Cleanup: Make memory barrier definitions consistent across kernels
We inherited membar_consumer() and membar_producer() from OpenSolaris, but we had replaced membar_consumer() with Linux's smp_rmb() in zfs_ioctl.c. The FreeBSD SPL consequently implemented a shim for the Linux-only smp_rmb(). We reinstate membar_consumer() in platform independent code and fix the FreeBSD SPL to implement membar_consumer() in a way analogous to Linux. Reviewed-by: Konstantin Belousov <kib@FreeBSD.org> Reviewed-by: Mateusz Guzik <mjguzik@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Neal Gompa <ngompa@datto.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #13843
Diffstat (limited to 'include/os/freebsd/spl')
-rw-r--r--include/os/freebsd/spl/sys/atomic.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/os/freebsd/spl/sys/atomic.h b/include/os/freebsd/spl/sys/atomic.h
index 1a68bfc4de23..01b13fc9afd7 100644
--- a/include/os/freebsd/spl/sys/atomic.h
+++ b/include/os/freebsd/spl/sys/atomic.h
@@ -57,7 +57,8 @@ extern uint64_t atomic_cas_64(volatile uint64_t *target, uint64_t cmp,
uint64_t newval);
#endif
-#define membar_producer atomic_thread_fence_rel
+#define membar_consumer() atomic_thread_fence_acq()
+#define membar_producer() atomic_thread_fence_rel()
static __inline uint32_t
atomic_add_32_nv(volatile uint32_t *target, int32_t delta)