diff options
| author | Changli Gao <xiaosuo@gmail.com> | 2010-05-07 02:33:26 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-05-11 11:43:58 -0400 |
| commit | a93d2f1744206827ccf416e2cdc5018aa503314e (patch) | |
| tree | c4c9daf16536d8d58db275617e19898f6c5bdbd7 /include | |
| parent | af507ae8a0512a83728b17d8f8c5fa1561669f50 (diff) | |
sched, wait: Use wrapper functions
epoll should not touch flags in wait_queue_t. This patch introduces a new
function __add_wait_queue_exclusive(), for the users, who use wait queue as a
LIFO queue.
__add_wait_queue_tail_exclusive() is introduced too instead of
add_wait_queue_exclusive_locked(). remove_wait_queue_locked() is removed, as
it is a duplicate of __remove_wait_queue(), disliked by users, and with less
users.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: <containers@lists.linux-foundation.org>
LKML-Reference: <1273214006-2979-1-git-send-email-xiaosuo@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/wait.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index a48e16b77d5e..76d96d035ea0 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -127,12 +127,26 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) | |||
| 127 | /* | 127 | /* |
| 128 | * Used for wake-one threads: | 128 | * Used for wake-one threads: |
| 129 | */ | 129 | */ |
| 130 | static inline void __add_wait_queue_exclusive(wait_queue_head_t *q, | ||
| 131 | wait_queue_t *wait) | ||
| 132 | { | ||
| 133 | wait->flags |= WQ_FLAG_EXCLUSIVE; | ||
| 134 | __add_wait_queue(q, wait); | ||
| 135 | } | ||
| 136 | |||
| 130 | static inline void __add_wait_queue_tail(wait_queue_head_t *head, | 137 | static inline void __add_wait_queue_tail(wait_queue_head_t *head, |
| 131 | wait_queue_t *new) | 138 | wait_queue_t *new) |
| 132 | { | 139 | { |
| 133 | list_add_tail(&new->task_list, &head->task_list); | 140 | list_add_tail(&new->task_list, &head->task_list); |
| 134 | } | 141 | } |
| 135 | 142 | ||
| 143 | static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q, | ||
| 144 | wait_queue_t *wait) | ||
| 145 | { | ||
| 146 | wait->flags |= WQ_FLAG_EXCLUSIVE; | ||
| 147 | __add_wait_queue_tail(q, wait); | ||
| 148 | } | ||
| 149 | |||
| 136 | static inline void __remove_wait_queue(wait_queue_head_t *head, | 150 | static inline void __remove_wait_queue(wait_queue_head_t *head, |
| 137 | wait_queue_t *old) | 151 | wait_queue_t *old) |
| 138 | { | 152 | { |
| @@ -404,25 +418,6 @@ do { \ | |||
| 404 | }) | 418 | }) |
| 405 | 419 | ||
| 406 | /* | 420 | /* |
| 407 | * Must be called with the spinlock in the wait_queue_head_t held. | ||
| 408 | */ | ||
| 409 | static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q, | ||
| 410 | wait_queue_t * wait) | ||
| 411 | { | ||
| 412 | wait->flags |= WQ_FLAG_EXCLUSIVE; | ||
| 413 | __add_wait_queue_tail(q, wait); | ||
| 414 | } | ||
| 415 | |||
| 416 | /* | ||
| 417 | * Must be called with the spinlock in the wait_queue_head_t held. | ||
| 418 | */ | ||
| 419 | static inline void remove_wait_queue_locked(wait_queue_head_t *q, | ||
| 420 | wait_queue_t * wait) | ||
| 421 | { | ||
| 422 | __remove_wait_queue(q, wait); | ||
| 423 | } | ||
| 424 | |||
| 425 | /* | ||
| 426 | * These are the old interfaces to sleep waiting for an event. | 421 | * These are the old interfaces to sleep waiting for an event. |
| 427 | * They are racy. DO NOT use them, use the wait_event* interfaces above. | 422 | * They are racy. DO NOT use them, use the wait_event* interfaces above. |
| 428 | * We plan to remove these interfaces. | 423 | * We plan to remove these interfaces. |
