summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2000-09-13 18:28:14 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2000-09-13 18:28:14 +0000
commit220ca3ff5e4f29e5b427150bc2bb29289fce220a (patch)
tree41dc929e148512cc919fdca27f5d834f9e222c40
parent699fbdc2ab737503a3992edb73cb225ce4307b40 (diff)
Notes
-rw-r--r--sys/alpha/include/mutex.h12
-rw-r--r--sys/powerpc/include/mutex.h12
2 files changed, 14 insertions, 10 deletions
diff --git a/sys/alpha/include/mutex.h b/sys/alpha/include/mutex.h
index a6aad99faa4b..ae4b5bb88eb9 100644
--- a/sys/alpha/include/mutex.h
+++ b/sys/alpha/include/mutex.h
@@ -312,8 +312,7 @@ void witness_restore(mtx_t *, const char *, int);
if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
else { \
- if (((mp)->mtx_lock & MTX_RECURSE) == 0) \
- atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
+ atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
(mp)->mtx_recurse++; \
} \
} else { \
@@ -379,12 +378,15 @@ void witness_restore(mtx_t *, const char *, int);
*/
#define _exitlock_spin(mp) do { \
- int _ipl = (mp)->mtx_saveipl; \
alpha_mb(); \
- if ((mp)->mtx_recurse == 0 || (--(mp)->mtx_recurse) == 0) \
+ if ((mp)->mtx_recurse == 0) { \
+ int _ipl = (mp)->mtx_saveipl; \
atomic_cmpset_64(&(mp)->mtx_lock, (mp)->mtx_lock, \
MTX_UNOWNED); \
- alpha_pal_swpipl(_ipl); \
+ alpha_pal_swpipl(_ipl); \
+ } else { \
+ (mp)->mtx_recurse--; \
+ } \
} while (0)
/*
diff --git a/sys/powerpc/include/mutex.h b/sys/powerpc/include/mutex.h
index a6aad99faa4b..ae4b5bb88eb9 100644
--- a/sys/powerpc/include/mutex.h
+++ b/sys/powerpc/include/mutex.h
@@ -312,8 +312,7 @@ void witness_restore(mtx_t *, const char *, int);
if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
else { \
- if (((mp)->mtx_lock & MTX_RECURSE) == 0) \
- atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
+ atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
(mp)->mtx_recurse++; \
} \
} else { \
@@ -379,12 +378,15 @@ void witness_restore(mtx_t *, const char *, int);
*/
#define _exitlock_spin(mp) do { \
- int _ipl = (mp)->mtx_saveipl; \
alpha_mb(); \
- if ((mp)->mtx_recurse == 0 || (--(mp)->mtx_recurse) == 0) \
+ if ((mp)->mtx_recurse == 0) { \
+ int _ipl = (mp)->mtx_saveipl; \
atomic_cmpset_64(&(mp)->mtx_lock, (mp)->mtx_lock, \
MTX_UNOWNED); \
- alpha_pal_swpipl(_ipl); \
+ alpha_pal_swpipl(_ipl); \
+ } else { \
+ (mp)->mtx_recurse--; \
+ } \
} while (0)
/*