diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-21 04:34:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-21 04:34:13 +0000 |
commit | e98d69b14dd08856abde29fb967f9eb1c845bb3a (patch) | |
tree | 944b112e2faa13021c7af6cb8e644090316911cf /sys/arch/sgi | |
parent | f2eeae2112eae0b48bcd954af6ff7d73a0e39ab1 (diff) |
Revert the ``remove the `skip splraise/splx for IPL_NONE mutexes' optimization''
change. It seems to have unexpected side effects, especially on MP systems,
and drahn@ disagrees with the way this change has been done and think there
is a better way to solve the original problem of msleep() fiddling with
mutex internals.
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r-- | sys/arch/sgi/sgi/mutex.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/arch/sgi/sgi/mutex.c b/sys/arch/sgi/sgi/mutex.c index 57ca2e62ff3..2c85fa89e19 100644 --- a/sys/arch/sgi/sgi/mutex.c +++ b/sys/arch/sgi/sgi/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.11 2011/04/03 22:26:24 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.12 2011/04/21 04:34:12 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -70,16 +70,19 @@ mtx_enter(struct mutex *mtx) int s; for (;;) { - s = splraise(mtx->mtx_wantipl); + if (mtx->mtx_wantipl != IPL_NONE) + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - mtx->mtx_oldipl = s; + if (mtx->mtx_wantipl != IPL_NONE) + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return; } - splx(s); + if (mtx->mtx_wantipl != IPL_NONE) + splx(s); } } @@ -88,16 +91,19 @@ mtx_enter_try(struct mutex *mtx) { int s; - s = splraise(mtx->mtx_wantipl); + if (mtx->mtx_wantipl != IPL_NONE) + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - mtx->mtx_oldipl = s; + if (mtx->mtx_wantipl != IPL_NONE) + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return 1; } - splx(s); + if (mtx->mtx_wantipl != IPL_NONE) + splx(s); return 0; } @@ -113,5 +119,6 @@ mtx_leave(struct mutex *mtx) s = mtx->mtx_oldipl; mtx->mtx_owner = NULL; mtx->mtx_lock = 0; - splx(s); + if (mtx->mtx_wantipl != IPL_NONE) + splx(s); } |