aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/locking.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2011-03-31 10:47:01 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-18 09:50:46 -0400
commit26c0ddabb1efb8a7360bbd423561d2196b61424c (patch)
tree9f7b7b1d769fdfe56894808107d1fdde480743af /litmus/locking.c
parent4df6011f5e571630cd99cd29b36bc8a701520540 (diff)
Improve FMLP queue management.
The next owner of a FMLP-protected resource is dequeued from the FMLP FIFO queue by unlock() (when the resource is freed by the previous owner) instead of performing the dequeue by the next owner immediately after it has been woken up. This simplifies the code a little bit and also reduces potential spinlock contention.
Diffstat (limited to 'litmus/locking.c')
-rw-r--r--litmus/locking.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/litmus/locking.c b/litmus/locking.c
index 728b56835cf7..2693f1aca859 100644
--- a/litmus/locking.c
+++ b/litmus/locking.c
@@ -107,16 +107,18 @@ asmlinkage long sys_litmus_unlock(int lock_od)
107 return err; 107 return err;
108} 108}
109 109
110struct task_struct* waitqueue_first(wait_queue_head_t *wq) 110struct task_struct* __waitqueue_remove_first(wait_queue_head_t *wq)
111{ 111{
112 wait_queue_t *q; 112 wait_queue_t* q;
113 struct task_struct* t = NULL;
113 114
114 if (waitqueue_active(wq)) { 115 if (waitqueue_active(wq)) {
115 q = list_entry(wq->task_list.next, 116 q = list_entry(wq->task_list.next,
116 wait_queue_t, task_list); 117 wait_queue_t, task_list);
117 return (struct task_struct*) q->private; 118 t = (struct task_struct*) q->private;
118 } else 119 __remove_wait_queue(wq, q);
119 return NULL; 120 }
121 return(t);
120} 122}
121 123
122 124