diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-03 18:46:42 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-03 18:46:42 +0000 |
commit | a6353483b94ab2a137a9b22b497213fb3e42d30f (patch) | |
tree | 7f03af461756562fa42aa96c4f5185b07ccb089d /sys | |
parent | 42cad736a05d3379f03bc81bc9d230c7b04b4d7a (diff) |
Remove the `skip splraise/splx for IPL_NONE mutexes' optimizations. It is not
always gaining anything, and msleep() implementation depends upon mtx_leave()
invoking splx().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/alpha/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/mutex.c | 23 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/loongson/loongson/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/m68k/m68k/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/mutex.S | 20 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/mutex.c | 23 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/mutex.c | 23 | ||||
-rw-r--r-- | sys/arch/sh/sh/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/mutex.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/vax/mutex.c | 11 |
11 files changed, 60 insertions, 120 deletions
diff --git a/sys/arch/alpha/alpha/mutex.c b/sys/arch/alpha/alpha/mutex.c index 6b8f1e66b15..747753b9157 100644 --- a/sys/arch/alpha/alpha/mutex.c +++ b/sys/arch/alpha/alpha/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:52 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.6 2011/04/03 18:46:38 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -50,8 +50,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -62,8 +61,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -81,6 +79,5 @@ mtx_leave(struct mutex *mtx) #ifdef DIAGNOSTIC curcpu()->ci_mutex_level--; #endif - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } diff --git a/sys/arch/hppa/hppa/mutex.c b/sys/arch/hppa/hppa/mutex.c index 2710cfb8d13..33638801e65 100644 --- a/sys/arch/hppa/hppa/mutex.c +++ b/sys/arch/hppa/hppa/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.9 2010/09/28 20:27:54 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.10 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -66,19 +66,16 @@ mtx_enter(struct mutex *mtx) int s; for (;;) { - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); } } @@ -87,19 +84,16 @@ mtx_enter_try(struct mutex *mtx) { int s; - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return 1; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); return 0; } @@ -122,6 +116,5 @@ mtx_leave(struct mutex *mtx) mtx->mtx_lock[2] = 1; mtx->mtx_lock[3] = 1; - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); } diff --git a/sys/arch/hppa64/hppa64/mutex.c b/sys/arch/hppa64/hppa64/mutex.c index 4f2c28b36fe..7a1efbe5060 100644 --- a/sys/arch/hppa64/hppa64/mutex.c +++ b/sys/arch/hppa64/hppa64/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:54 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.6 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -48,8 +48,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -60,8 +59,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -79,6 +77,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } diff --git a/sys/arch/loongson/loongson/mutex.c b/sys/arch/loongson/loongson/mutex.c index adceeca014a..648bee18fbb 100644 --- a/sys/arch/loongson/loongson/mutex.c +++ b/sys/arch/loongson/loongson/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.2 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.3 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -50,8 +50,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -63,8 +62,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -83,6 +81,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } diff --git a/sys/arch/m68k/m68k/mutex.c b/sys/arch/m68k/m68k/mutex.c index e4c59d23734..a4915fc1caf 100644 --- a/sys/arch/m68k/m68k/mutex.c +++ b/sys/arch/m68k/m68k/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.6 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.7 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -51,8 +51,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl)); + mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl)); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -64,8 +63,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl)); + mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl)); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -83,6 +81,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } diff --git a/sys/arch/m88k/m88k/mutex.S b/sys/arch/m88k/m88k/mutex.S index 007ca1482fc..787efabe879 100644 --- a/sys/arch/m88k/m88k/mutex.S +++ b/sys/arch/m88k/m88k/mutex.S @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.S,v 1.9 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.S,v 1.10 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -54,9 +54,7 @@ ENTRY(mtx_enter) st r2, r31, 0 /* save mtx */ enter_again: ld r2, r2, MTX_WANTIPL - bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ -1: ld r4, r31, 0 or r3, r0, 1 xmem r3, r4, r0 /* attempt to claim the lock, old */ @@ -76,8 +74,6 @@ enter_again: addu r31, r31, 8 enter_failed: /* the lock is not ours... */ - ld r3, r4, MTX_WANTIPL - bcnd eq0, r3, 2f bcnd ne0, r2, 1f /* splx(oldipl) */ bsr.n _C_LABEL(spl0) addu r1, r1, 2f - . - 4 @@ -111,9 +107,7 @@ enter_panic: st r2, r31, 0 /* save mtx */ ld r2, r2, MTX_WANTIPL - bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ -1: ld r4, r31, 0 ldcr r3, CPU st r3, r4, MTX_LOCK /* locked! */ @@ -147,9 +141,7 @@ ENTRY(mtx_enter_try) st r2, r31, 0 /* save mtx */ enter_try_again: ld r2, r2, MTX_WANTIPL - bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ -1: ld r4, r31, 0 or r3, r0, 1 xmem r3, r4, r0 /* attempt to claim the lock, old */ @@ -170,8 +162,6 @@ enter_try_again: addu r31, r31, 8 enter_try_failed: /* the lock is not ours... */ - ld r3, r4, MTX_WANTIPL - bcnd eq0, r3, 2f bcnd ne0, r2, 1f /* splx(oldipl) */ bsr.n _C_LABEL(spl0) addu r1, r1, 2f - . - 4 @@ -204,9 +194,7 @@ enter_try_panic: st r2, r31, 0 /* save mtx */ ld r2, r2, MTX_WANTIPL - bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ -1: ld r4, r31, 0 ldcr r3, CPU st r3, r4, MTX_LOCK /* locked! */ @@ -234,7 +222,6 @@ enter_try_panic: */ ENTRY(mtx_leave) ld r3, r2, MTX_OLDIPL - ld r4, r2, MTX_WANTIPL #ifdef DIAGNOSTIC ld r5, r2, MTX_CPU ld r6, r5, CI_MUTEX_LEVEL @@ -242,13 +229,10 @@ ENTRY(mtx_leave) st r6, r5, CI_MUTEX_LEVEL #endif st r0, r2, MTX_CPU /* mtx->mtx_cpu = NULL */ - bcnd.n eq0, r4, 2f - st r0, r2, MTX_LOCK /* mtx->mtx_lock = 0 */ + st r0, r2, MTX_LOCK /* mtx->mtx_lock = 0 */ bcnd ne0, r3, 1f /* splx(mtx->mtx_oldipl) */ br _C_LABEL(spl0) 1: br.n _C_LABEL(setipl) or r2, r3, r0 -2: - jmp r1 diff --git a/sys/arch/octeon/octeon/mutex.c b/sys/arch/octeon/octeon/mutex.c index 4135e53139f..1d6ae9a7a6a 100644 --- a/sys/arch/octeon/octeon/mutex.c +++ b/sys/arch/octeon/octeon/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.2 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.3 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -70,19 +70,16 @@ mtx_enter(struct mutex *mtx) int s; int i = 10000000; for (;;) { - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); if(i-- <= 0) panic("mtx_enter timed out\n"); } @@ -93,19 +90,16 @@ mtx_enter_try(struct mutex *mtx) { int s; - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return 1; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); return 0; } @@ -117,7 +111,6 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); mtx->mtx_owner = NULL; } diff --git a/sys/arch/sgi/sgi/mutex.c b/sys/arch/sgi/sgi/mutex.c index 9276f04752a..1f699521bb8 100644 --- a/sys/arch/sgi/sgi/mutex.c +++ b/sys/arch/sgi/sgi/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.9 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.10 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -70,19 +70,16 @@ mtx_enter(struct mutex *mtx) int s; for (;;) { - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); } } @@ -91,19 +88,16 @@ mtx_enter_try(struct mutex *mtx) { int s; - if (mtx->mtx_wantipl != IPL_NONE) - s = splraise(mtx->mtx_wantipl); + s = splraise(mtx->mtx_wantipl); if (try_lock(mtx)) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = s; + mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level++; #endif return 1; } - if (mtx->mtx_wantipl != IPL_NONE) - splx(s); + splx(s); return 0; } @@ -115,7 +109,6 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); mtx->mtx_owner = NULL; } diff --git a/sys/arch/sh/sh/mutex.c b/sys/arch/sh/sh/mutex.c index c862cb77989..432bcd0a4cf 100644 --- a/sys/arch/sh/sh/mutex.c +++ b/sys/arch/sh/sh/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.6 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -50,8 +50,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE << 4) - mtx->mtx_oldipl = _cpu_intr_raise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _cpu_intr_raise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -63,8 +62,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _cpu_intr_raise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _cpu_intr_raise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -82,6 +80,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE << 4) - _cpu_intr_resume(mtx->mtx_oldipl); + _cpu_intr_resume(mtx->mtx_oldipl); } diff --git a/sys/arch/sparc/sparc/mutex.c b/sys/arch/sparc/sparc/mutex.c index 4ed1528a275..03b532d018a 100644 --- a/sys/arch/sparc/sparc/mutex.c +++ b/sys/arch/sparc/sparc/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:55 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.6 2011/04/03 18:46:40 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -52,12 +52,10 @@ mtx_enter(struct mutex *mtx) { int psr; - if (mtx->mtx_wantipl != IPL_NONE << 8) { - psr = getpsr(); - mtx->mtx_oldipl = psr & PSR_PIL; - if (mtx->mtx_oldipl < mtx->mtx_wantipl) - setpsr((psr & ~PSR_PIL) | mtx->mtx_wantipl); - } + psr = getpsr(); + mtx->mtx_oldipl = psr & PSR_PIL; + if (mtx->mtx_oldipl < mtx->mtx_wantipl) + setpsr((psr & ~PSR_PIL) | mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -71,12 +69,10 @@ mtx_enter_try(struct mutex *mtx) { int psr; - if (mtx->mtx_wantipl != IPL_NONE << 8) { - psr = getpsr(); - mtx->mtx_oldipl = psr & PSR_PIL; - if (mtx->mtx_oldipl < mtx->mtx_wantipl) - setpsr((psr & ~PSR_PIL) | mtx->mtx_wantipl); - } + psr = getpsr(); + mtx->mtx_oldipl = psr & PSR_PIL; + if (mtx->mtx_oldipl < mtx->mtx_wantipl) + setpsr((psr & ~PSR_PIL) | mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -95,6 +91,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE << 8) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } diff --git a/sys/arch/vax/vax/mutex.c b/sys/arch/vax/vax/mutex.c index d960eab3f1e..4757ce45347 100644 --- a/sys/arch/vax/vax/mutex.c +++ b/sys/arch/vax/vax/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:56 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.6 2011/04/03 18:46:41 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -50,8 +50,7 @@ mtx_init(struct mutex *mtx, int wantipl) void mtx_enter(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; @@ -63,8 +62,7 @@ mtx_enter(struct mutex *mtx) int mtx_enter_try(struct mutex *mtx) { - if (mtx->mtx_wantipl != IPL_NONE) - mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); + mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl); MUTEX_ASSERT_UNLOCKED(mtx); mtx->mtx_lock = 1; #ifdef DIAGNOSTIC @@ -82,6 +80,5 @@ mtx_leave(struct mutex *mtx) curcpu()->ci_mutex_level--; #endif mtx->mtx_lock = 0; - if (mtx->mtx_wantipl != IPL_NONE) - splx(mtx->mtx_oldipl); + splx(mtx->mtx_oldipl); } |