Index: kernel/generic/src/synch/futex.c
===================================================================
--- kernel/generic/src/synch/futex.c	(revision 045523247b162c88f46808e9415ee4bbc16ad5d7)
+++ kernel/generic/src/synch/futex.c	(revision 207e8880edd0594e088f82fd9dbaf16946b8317c)
@@ -121,5 +121,5 @@
  * Acquire task specific TASK->futex_list_lock before this mutex.
  */
-static mutex_t futex_ht_lock;
+SPINLOCK_STATIC_INITIALIZE_NAME(futex_ht_lock, "futex-ht-lock");
 
 /** Global kernel futex hash table. Lock futex_ht_lock before accessing.
@@ -148,5 +148,4 @@
 void futex_init(void)
 {
-	mutex_initialize(&futex_ht_lock, MUTEX_PASSIVE);
 	hash_table_create(&futex_ht, FUTEX_HT_SIZE, 1, &futex_ht_ops);
 }
@@ -160,5 +159,5 @@
 	
 	list_initialize(&task->futexes->list);
-	mutex_initialize(&task->futexes->list_lock, MUTEX_PASSIVE);
+	spinlock_initialize(&task->futexes->list_lock, "futex-list-lock");
 }
 
@@ -206,5 +205,5 @@
 	
 	/* All threads of this task have terminated. This is the last thread. */
-	mutex_lock(&futexes->list_lock);
+	spinlock_lock(&futexes->list_lock);
 	
 	list_foreach_safe(futexes->list, cur_link, next_link) {
@@ -222,5 +221,5 @@
 	}
 	
-	mutex_unlock(&futexes->list_lock);
+	spinlock_unlock(&futexes->list_lock);
 }
 
@@ -242,5 +241,5 @@
 static void futex_add_ref(futex_t *futex)
 {
-	ASSERT(mutex_locked(&futex_ht_lock));
+	ASSERT(spinlock_locked(&futex_ht_lock));
 	ASSERT(0 < futex->refcount);
 	++futex->refcount;
@@ -250,5 +249,5 @@
 static void futex_release_ref(futex_t *futex)
 {
-	ASSERT(mutex_locked(&futex_ht_lock));
+	ASSERT(spinlock_locked(&futex_ht_lock));
 	ASSERT(0 < futex->refcount);
 	
@@ -263,7 +262,7 @@
 static void futex_release_ref_locked(futex_t *futex)
 {
-	mutex_lock(&futex_ht_lock);
+	spinlock_lock(&futex_ht_lock);
 	futex_release_ref(futex);
-	mutex_unlock(&futex_ht_lock);
+	spinlock_unlock(&futex_ht_lock);
 }
 
@@ -278,6 +277,7 @@
 	uintptr_t paddr;
 
-	if (!find_futex_paddr(uaddr, &paddr)) 
+	if (!find_futex_paddr(uaddr, &paddr)) {
 		return 0;
+	}
 
 	return get_and_cache_futex(paddr, uaddr);
@@ -288,8 +288,9 @@
 static bool find_futex_paddr(uintptr_t uaddr, uintptr_t *paddr)
 {
-	page_table_lock(AS, true);
+	spinlock_lock(&futex_ht_lock);
+	page_table_lock(AS, false);
 
 	bool found = false;
-	pte_t *t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE), false);
+	pte_t *t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE), true);
 	
 	if (t && PTE_VALID(t) && PTE_PRESENT(t)) {
@@ -298,5 +299,6 @@
 	}
 	
-	page_table_unlock(AS, true);
+	page_table_unlock(AS, false);
+	spinlock_unlock(&futex_ht_lock);
 	
 	return found;
@@ -338,5 +340,5 @@
 	 * if it is not present).
 	 */
-	mutex_lock(&futex_ht_lock);
+	spinlock_lock(&futex_ht_lock);
 	
 	link_t *fut_link = hash_table_find(&futex_ht, &phys_addr);
@@ -351,5 +353,5 @@
 	}
 	
-	mutex_unlock(&futex_ht_lock);
+	spinlock_unlock(&futex_ht_lock);
 	
 	/* 
@@ -366,7 +368,7 @@
 	/* Cache the mapping from the virtual address to the futex for this task. */
 	if (cht_insert_unique(&TASK->futexes->ht, &fut_ptr->cht_link, &dup_link)) {
-		mutex_lock(&TASK->futexes->list_lock);
+		spinlock_lock(&TASK->futexes->list_lock);
 		list_append(&fut_ptr->all_link, &TASK->futexes->list);
-		mutex_unlock(&TASK->futexes->list_lock);
+		spinlock_unlock(&TASK->futexes->list_lock);
 	} else {
 		/* Another thread of this task beat us to it. Use that mapping instead.*/
@@ -398,11 +400,6 @@
 		return (sysarg_t) ENOENT;
 
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_begin();
-#endif
 	int rc = waitq_sleep_timeout(&futex->wq, 0, SYNCH_FLAGS_INTERRUPTIBLE); 
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_end();
-#endif
+
 	return (sysarg_t) rc;
 }
