sched/wait: Add add_wait_queue_priority()
[linux-2.6-microblaze.git] / include / linux / wait.h
index 27fb99c..fe10e85 100644 (file)
@@ -22,6 +22,7 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int
 #define WQ_FLAG_BOOKMARK       0x04
 #define WQ_FLAG_CUSTOM         0x08
 #define WQ_FLAG_DONE           0x10
+#define WQ_FLAG_PRIORITY       0x20
 
 /*
  * A single wait-queue entry structure:
@@ -164,11 +165,20 @@ static inline bool wq_has_sleeper(struct wait_queue_head *wq_head)
 
 extern void add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry);
 extern void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry);
+extern void add_wait_queue_priority(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry);
 extern void remove_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry);
 
 static inline void __add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry)
 {
-       list_add(&wq_entry->entry, &wq_head->head);
+       struct list_head *head = &wq_head->head;
+       struct wait_queue_entry *wq;
+
+       list_for_each_entry(wq, &wq_head->head, entry) {
+               if (!(wq->flags & WQ_FLAG_PRIORITY))
+                       break;
+               head = &wq->entry;
+       }
+       list_add(&wq_entry->entry, head);
 }
 
 /*