aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/locking.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2011-03-31 10:47:01 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2011-03-31 10:47:01 -0400
commit0f6a8e02773f8c23b5b6a3dbfa044e50c9d7d811 (patch)
treeae9ee07707eaeefc6f7c3cc09d74e40e8c3a1eef /litmus/locking.c
parentc05eaa8091d2cadc20363d44a85ee454262f4bc2 (diff)
Improve FMLP queue management.wip-fmlp-dequeue
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