summaryrefslogtreecommitdiff
path: root/kern/mutex/mutex_adaptive.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-07-10 19:40:05 +0200
committerRichard Braun <rbraun@sceen.net>2018-07-10 19:40:05 +0200
commit9ea1595a9156f2818b216d883e25f63bd74459c0 (patch)
treeaacf50829edcdce7a356c6bc8d629be82238e5fd /kern/mutex/mutex_adaptive.c
parent7cab594590002ff3737629b76083a298616b665a (diff)
kern/sleepq: make disabling interrupts optional
Commit d2a89f7f6e976d022527c2a5a1c75268aab8cd49 changed sleep queues to allow semaphores to be signalled from interrupt handlers, but this implied disabling interrupts for all synchronization objects, and most of them do not require interrupts to be disabled. The sleep queue interface is augmented with interrupt-related versions.
Diffstat (limited to 'kern/mutex/mutex_adaptive.c')
-rw-r--r--kern/mutex/mutex_adaptive.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kern/mutex/mutex_adaptive.c b/kern/mutex/mutex_adaptive.c
index d17ad9d4..6c99eaf9 100644
--- a/kern/mutex/mutex_adaptive.c
+++ b/kern/mutex/mutex_adaptive.c
@@ -124,13 +124,12 @@ mutex_adaptive_lock_slow_common(struct mutex *mutex, bool timed, uint64_t ticks)
uintptr_t self, owner;
struct sleepq *sleepq;
struct thread *thread;
- unsigned long flags;
int error;
error = 0;
self = (uintptr_t)thread_self();
- sleepq = sleepq_lend(mutex, false, &flags);
+ sleepq = sleepq_lend(mutex, false);
mutex_adaptive_set_contended(mutex);
@@ -223,7 +222,7 @@ mutex_adaptive_lock_slow_common(struct mutex *mutex, bool timed, uint64_t ticks)
}
out:
- sleepq_return(sleepq, flags);
+ sleepq_return(sleepq);
return error;
}
@@ -248,7 +247,6 @@ mutex_adaptive_unlock_slow(struct mutex *mutex)
{
uintptr_t self, owner;
struct sleepq *sleepq;
- unsigned long flags;
int error;
self = (uintptr_t)thread_self() | MUTEX_ADAPTIVE_CONTENDED;
@@ -301,12 +299,12 @@ mutex_adaptive_unlock_slow(struct mutex *mutex)
* on the current thread, in which case the latter doesn't return,
* averting the need for an additional reference.
*/
- sleepq = sleepq_tryacquire(mutex, false, &flags);
+ sleepq = sleepq_tryacquire(mutex, false);
if (sleepq != NULL) {
mutex_adaptive_inc_sc(MUTEX_ADAPTIVE_SC_SIGNALS);
sleepq_signal(sleepq);
- sleepq_release(sleepq, flags);
+ sleepq_release(sleepq);
break;
}