Name: Allow Futex Rehashing In Interrupt Author: Rusty Russell Status: Tested on 2.6.0-test4-bk2 Depends: Depends: Misc/qemu-page-offset.patch.gz D: This patch simply uses spin_lock_irq() instead of spin_lock for the D: futex lock, in preparation for the futex_rehash patch which needs to D: operate on the futex hash table in IRQ context. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .5392-linux-2.6.0-test4-bk2/kernel/futex.c .5392-linux-2.6.0-test4-bk2.updated/kernel/futex.c --- .5392-linux-2.6.0-test4-bk2/kernel/futex.c 2003-08-28 17:51:06.000000000 +1000 +++ .5392-linux-2.6.0-test4-bk2.updated/kernel/futex.c 2003-08-28 17:51:37.000000000 +1000 @@ -74,12 +74,12 @@ static inline void lock_futex_mm(void) { spin_lock(¤t->mm->page_table_lock); spin_lock(&vcache_lock); - spin_lock(&futex_lock); + spin_lock_irq(&futex_lock); } static inline void unlock_futex_mm(void) { - spin_unlock(&futex_lock); + spin_unlock_irq(&futex_lock); spin_unlock(&vcache_lock); spin_unlock(¤t->mm->page_table_lock); } @@ -196,7 +196,7 @@ static void futex_vcache_callback(vcache struct futex_q *q = container_of(vcache, struct futex_q, vcache); struct list_head *head = hash_futex(new_page, q->offset); - spin_lock(&futex_lock); + spin_lock_irq(&futex_lock); if (!list_empty(&q->list)) { put_page(q->page); @@ -206,7 +206,7 @@ static void futex_vcache_callback(vcache list_add_tail(&q->list, head); } - spin_unlock(&futex_lock); + spin_unlock_irq(&futex_lock); } /* @@ -293,13 +293,13 @@ static inline int unqueue_me(struct fute int ret = 0; spin_lock(&vcache_lock); - spin_lock(&futex_lock); + spin_lock_irq(&futex_lock); if (!list_empty(&q->list)) { list_del(&q->list); __detach_vcache(&q->vcache); ret = 1; } - spin_unlock(&futex_lock); + spin_unlock_irq(&futex_lock); spin_unlock(&vcache_lock); return ret; } @@ -391,10 +391,10 @@ static unsigned int futex_poll(struct fi int ret = 0; poll_wait(filp, &q->waiters, wait); - spin_lock(&futex_lock); + spin_lock_irq(&futex_lock); if (list_empty(&q->list)) ret = POLLIN | POLLRDNORM; - spin_unlock(&futex_lock); + spin_unlock_irq(&futex_lock); return ret; }