summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_rmlock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2012-10-09 14:32:30 +0000
committerattilio <attilio@FreeBSD.org>2012-10-09 14:32:30 +0000
commit6997194551ffae05d71ea650af49c4551d753a1a (patch)
tree18e9f31a3018a88b46e78d76a45d0953dea5276b /sys/kern/kern_rmlock.c
parent6a02d06d1d81ffda0499310925ef854fd237f382 (diff)
downloadFreeBSD-src-6997194551ffae05d71ea650af49c4551d753a1a.zip
FreeBSD-src-6997194551ffae05d71ea650af49c4551d753a1a.tar.gz
Add an unified macro to deny ability from the compiler to reorder
instruction loads/stores at its will. The macro __compiler_membar() is currently supported for both gcc and clang, but kernel compilation will fail otherwise. Reviewed by: bde, kib Discussed with: dim, theraven MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_rmlock.c')
-rw-r--r--sys/kern/kern_rmlock.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index ef1920b..30400b1 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -65,10 +65,6 @@ __FBSDID("$FreeBSD$");
* does not seem very useful
*/
-static __inline void compiler_memory_barrier(void) {
- __asm __volatile("":::"memory");
-}
-
static void assert_rm(const struct lock_object *lock, int what);
static void lock_rm(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
@@ -353,7 +349,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
td->td_critnest++; /* critical_enter(); */
- compiler_memory_barrier();
+ __compiler_membar();
pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */
@@ -361,7 +357,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
sched_pin();
- compiler_memory_barrier();
+ __compiler_membar();
td->td_critnest--;
OpenPOWER on IntegriCloud