* [PATCH v2] wait: use wrapper functions
@ 2010-05-07 6:33 Changli Gao
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Changli Gao @ 2010-05-07 6:33 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexander Viro, Paul Menage, Li Zefan, Ingo Molnar,
Davide Libenzi, Peter Zijlstra, linux-fsdevel, linux-kernel,
containers, Changli Gao
use wrapper functions
epoll should not touch flags in wait_queue_t. This patch introduces a new
function __add_wait_queue_excl(), for the users, who use wait queue as a
LIFO queue.
__add_wait_queue_tail_excl() 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>
----
fs/eventpoll.c | 3 +--
include/linux/wait.h | 35 +++++++++++++++--------------------
kernel/cgroup.c | 2 +-
kernel/sched.c | 3 +--
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index bd056a5..a6ba470 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1140,8 +1140,7 @@ retry:
* ep_poll_callback() when events will become available.
*/
init_waitqueue_entry(&wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue(&ep->wq, &wait);
+ __add_wait_queue_excl(&ep->wq, &wait);
for (;;) {
/*
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b..4db4147 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)
/*
* Used for wake-one threads:
*/
+static inline void __add_wait_queue_excl(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue(q, wait);
+}
+
static inline void __add_wait_queue_tail(wait_queue_head_t *head,
- wait_queue_t *new)
+ wait_queue_t *new)
{
list_add_tail(&new->task_list, &head->task_list);
}
+static inline void __add_wait_queue_tail_excl(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue_tail(q, wait);
+}
+
static inline void __remove_wait_queue(wait_queue_head_t *head,
wait_queue_t *old)
{
@@ -404,25 +418,6 @@ do { \
})
/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- wait->flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(q, wait);
-}
-
-/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void remove_wait_queue_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- __remove_wait_queue(q, wait);
-}
-
-/*
* These are the old interfaces to sleep waiting for an event.
* They are racy. DO NOT use them, use the wait_event* interfaces above.
* We plan to remove these interfaces.
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e2769e1..4a07d05 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3010,7 +3010,7 @@ static int cgroup_event_wake(wait_queue_t *wait, unsigned mode,
unsigned long flags = (unsigned long)key;
if (flags & POLLHUP) {
- remove_wait_queue_locked(event->wqh, &event->wait);
+ __remove_wait_queue(event->wqh, &event->wait);
spin_lock(&cgrp->event_list_lock);
list_del(&event->list);
spin_unlock(&cgrp->event_list_lock);
diff --git a/kernel/sched.c b/kernel/sched.c
index 6af210a..c5c998d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4039,8 +4039,7 @@ do_wait_for_common(struct completion *x, long timeout, int state)
if (!x->done) {
DECLARE_WAITQUEUE(wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(&x->wait, &wait);
+ __add_wait_queue_tail_excl(&x->wait, &wait);
do {
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
^ permalink raw reply related [flat|nested] 9+ messages in thread[parent not found: <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2] wait: use wrapper functions
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-05-07 10:12 ` Peter Zijlstra
2010-05-07 20:52 ` Andrew Morton
2010-05-11 18:30 ` [tip:sched/core] sched, wait: Use " tip-bot for Changli Gao
2 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2010-05-07 10:12 UTC (permalink / raw)
To: Changli Gao
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
Ingo Molnar, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Alexander Viro,
Davide Libenzi, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Paul Menage,
Andrew Morton
On Fri, 2010-05-07 at 14:33 +0800, Changli Gao wrote:
> use wrapper functions
>
> epoll should not touch flags in wait_queue_t. This patch introduces a new
> function __add_wait_queue_excl(), for the users, who use wait queue as a
> LIFO queue.
>
> __add_wait_queue_tail_excl() 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Looks good to me. I can feed it to Ingo if he doesn't pick it up
himself.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2] wait: use wrapper functions
2010-05-07 6:33 [PATCH v2] wait: use wrapper functions Changli Gao
@ 2010-05-07 20:52 ` Andrew Morton
2010-05-07 10:12 ` [PATCH v2] wait: use " Peter Zijlstra
2010-05-11 18:30 ` [tip:sched/core] sched, wait: Use " tip-bot for Changli Gao
2 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2010-05-07 20:52 UTC (permalink / raw)
To: Changli Gao
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Alexander Viro,
Davide Libenzi, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Paul Menage,
Ingo Molnar
On Fri, 7 May 2010 14:33:26 +0800
Changli Gao <xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> epoll should not touch flags in wait_queue_t. This patch introduces a new
> function __add_wait_queue_excl(), for the users, who use wait queue as a
> LIFO queue.
__add_wait_queue_exclusive(), please. Let's be consistent.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] wait: use wrapper functions
@ 2010-05-07 20:52 ` Andrew Morton
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2010-05-07 20:52 UTC (permalink / raw)
To: Changli Gao
Cc: Alexander Viro, Paul Menage, Li Zefan, Ingo Molnar,
Davide Libenzi, Peter Zijlstra, linux-fsdevel, linux-kernel,
containers
On Fri, 7 May 2010 14:33:26 +0800
Changli Gao <xiaosuo@gmail.com> wrote:
> epoll should not touch flags in wait_queue_t. This patch introduces a new
> function __add_wait_queue_excl(), for the users, who use wait queue as a
> LIFO queue.
__add_wait_queue_exclusive(), please. Let's be consistent.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] wait: use wrapper functions
2010-05-07 20:52 ` Andrew Morton
(?)
@ 2010-05-07 20:56 ` Peter Zijlstra
-1 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2010-05-07 20:56 UTC (permalink / raw)
To: Andrew Morton
Cc: Changli Gao, Alexander Viro, Paul Menage, Li Zefan, Ingo Molnar,
Davide Libenzi, linux-fsdevel, linux-kernel, containers
On Fri, 2010-05-07 at 13:52 -0700, Andrew Morton wrote:
> On Fri, 7 May 2010 14:33:26 +0800
> Changli Gao <xiaosuo@gmail.com> wrote:
>
> > epoll should not touch flags in wait_queue_t. This patch introduces a new
> > function __add_wait_queue_excl(), for the users, who use wait queue as a
> > LIFO queue.
>
> __add_wait_queue_exclusive(), please. Let's be consistent.
done
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20100507135220.a972a6b2.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>]
* Re: [PATCH v2] wait: use wrapper functions
[not found] ` <20100507135220.a972a6b2.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2010-05-07 20:56 ` Peter Zijlstra
0 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2010-05-07 20:56 UTC (permalink / raw)
To: Andrew Morton
Cc: Changli Gao,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Alexander Viro,
Davide Libenzi, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Paul Menage,
Ingo Molnar
On Fri, 2010-05-07 at 13:52 -0700, Andrew Morton wrote:
> On Fri, 7 May 2010 14:33:26 +0800
> Changli Gao <xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > epoll should not touch flags in wait_queue_t. This patch introduces a new
> > function __add_wait_queue_excl(), for the users, who use wait queue as a
> > LIFO queue.
>
> __add_wait_queue_exclusive(), please. Let's be consistent.
done
^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:sched/core] sched, wait: Use wrapper functions
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-05-07 10:12 ` Peter Zijlstra
2010-05-07 20:52 ` Andrew Morton
@ 2010-05-11 18:30 ` tip-bot for Changli Gao
2 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Changli Gao @ 2010-05-11 18:30 UTC (permalink / raw)
To: linux-tip-commits-u79uwXL29TY76Z2rM5mHXA
Cc: a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
mingo-X9Un+BFzKDI, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
mingo-H+wXaHxf7aLQT0dZR+AlfA,
viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn,
xiaosuo-Re5JQEeQqe8AvxtiuMwx3w, hpa-YMNOUZJC4hwAvxtiuMwx3w,
menage-hpIqsD4AKlfQT0dZR+AlfA, davidel-AhlLAIvw+VEjIGhXcJzhZg,
tglx-hfZtesqFncYOwBW4kG4KsQ
Commit-ID: a93d2f1744206827ccf416e2cdc5018aa503314e
Gitweb: http://git.kernel.org/tip/a93d2f1744206827ccf416e2cdc5018aa503314e
Author: Changli Gao <xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
AuthorDate: Fri, 7 May 2010 14:33:26 +0800
Committer: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
CommitDate: Tue, 11 May 2010 17:43:58 +0200
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org>
Cc: Alexander Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Cc: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Davide Libenzi <davidel-AhlLAIvw+VEjIGhXcJzhZg@public.gmane.org>
Cc: <containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
LKML-Reference: <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
---
fs/eventpoll.c | 3 +--
include/linux/wait.h | 35 +++++++++++++++--------------------
kernel/cgroup.c | 2 +-
kernel/sched.c | 3 +--
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index bd056a5..3817149 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1140,8 +1140,7 @@ retry:
* ep_poll_callback() when events will become available.
*/
init_waitqueue_entry(&wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue(&ep->wq, &wait);
+ __add_wait_queue_exclusive(&ep->wq, &wait);
for (;;) {
/*
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b..76d96d0 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)
/*
* Used for wake-one threads:
*/
+static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue(q, wait);
+}
+
static inline void __add_wait_queue_tail(wait_queue_head_t *head,
- wait_queue_t *new)
+ wait_queue_t *new)
{
list_add_tail(&new->task_list, &head->task_list);
}
+static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue_tail(q, wait);
+}
+
static inline void __remove_wait_queue(wait_queue_head_t *head,
wait_queue_t *old)
{
@@ -404,25 +418,6 @@ do { \
})
/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- wait->flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(q, wait);
-}
-
-/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void remove_wait_queue_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- __remove_wait_queue(q, wait);
-}
-
-/*
* These are the old interfaces to sleep waiting for an event.
* They are racy. DO NOT use them, use the wait_event* interfaces above.
* We plan to remove these interfaces.
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e2769e1..4a07d05 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3010,7 +3010,7 @@ static int cgroup_event_wake(wait_queue_t *wait, unsigned mode,
unsigned long flags = (unsigned long)key;
if (flags & POLLHUP) {
- remove_wait_queue_locked(event->wqh, &event->wait);
+ __remove_wait_queue(event->wqh, &event->wait);
spin_lock(&cgrp->event_list_lock);
list_del(&event->list);
spin_unlock(&cgrp->event_list_lock);
diff --git a/kernel/sched.c b/kernel/sched.c
index 39aa9c7..b531d79 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3983,8 +3983,7 @@ do_wait_for_common(struct completion *x, long timeout, int state)
if (!x->done) {
DECLARE_WAITQUEUE(wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(&x->wait, &wait);
+ __add_wait_queue_tail_exclusive(&x->wait, &wait);
do {
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] wait: use wrapper functions
2010-05-07 6:33 [PATCH v2] wait: use wrapper functions Changli Gao
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-05-07 10:12 ` Peter Zijlstra
2010-05-11 18:30 ` [tip:sched/core] sched, wait: Use " tip-bot for Changli Gao
2 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2010-05-07 10:12 UTC (permalink / raw)
To: Changli Gao
Cc: Andrew Morton, Alexander Viro, Paul Menage, Li Zefan, Ingo Molnar,
Davide Libenzi, linux-fsdevel, linux-kernel, containers
On Fri, 2010-05-07 at 14:33 +0800, Changli Gao wrote:
> use wrapper functions
>
> epoll should not touch flags in wait_queue_t. This patch introduces a new
> function __add_wait_queue_excl(), for the users, who use wait queue as a
> LIFO queue.
>
> __add_wait_queue_tail_excl() 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>
Looks good to me. I can feed it to Ingo if he doesn't pick it up
himself.
^ permalink raw reply [flat|nested] 9+ messages in thread* [tip:sched/core] sched, wait: Use wrapper functions
2010-05-07 6:33 [PATCH v2] wait: use wrapper functions Changli Gao
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-05-07 10:12 ` [PATCH v2] wait: use " Peter Zijlstra
@ 2010-05-11 18:30 ` tip-bot for Changli Gao
2 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Changli Gao @ 2010-05-11 18:30 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, containers, hpa, mingo, lizf, a.p.zijlstra, viro,
xiaosuo, menage, davidel, tglx, mingo
Commit-ID: a93d2f1744206827ccf416e2cdc5018aa503314e
Gitweb: http://git.kernel.org/tip/a93d2f1744206827ccf416e2cdc5018aa503314e
Author: Changli Gao <xiaosuo@gmail.com>
AuthorDate: Fri, 7 May 2010 14:33:26 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 11 May 2010 17:43:58 +0200
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>
---
fs/eventpoll.c | 3 +--
include/linux/wait.h | 35 +++++++++++++++--------------------
kernel/cgroup.c | 2 +-
kernel/sched.c | 3 +--
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index bd056a5..3817149 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1140,8 +1140,7 @@ retry:
* ep_poll_callback() when events will become available.
*/
init_waitqueue_entry(&wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue(&ep->wq, &wait);
+ __add_wait_queue_exclusive(&ep->wq, &wait);
for (;;) {
/*
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b..76d96d0 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)
/*
* Used for wake-one threads:
*/
+static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue(q, wait);
+}
+
static inline void __add_wait_queue_tail(wait_queue_head_t *head,
- wait_queue_t *new)
+ wait_queue_t *new)
{
list_add_tail(&new->task_list, &head->task_list);
}
+static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q,
+ wait_queue_t *wait)
+{
+ wait->flags |= WQ_FLAG_EXCLUSIVE;
+ __add_wait_queue_tail(q, wait);
+}
+
static inline void __remove_wait_queue(wait_queue_head_t *head,
wait_queue_t *old)
{
@@ -404,25 +418,6 @@ do { \
})
/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- wait->flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(q, wait);
-}
-
-/*
- * Must be called with the spinlock in the wait_queue_head_t held.
- */
-static inline void remove_wait_queue_locked(wait_queue_head_t *q,
- wait_queue_t * wait)
-{
- __remove_wait_queue(q, wait);
-}
-
-/*
* These are the old interfaces to sleep waiting for an event.
* They are racy. DO NOT use them, use the wait_event* interfaces above.
* We plan to remove these interfaces.
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e2769e1..4a07d05 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3010,7 +3010,7 @@ static int cgroup_event_wake(wait_queue_t *wait, unsigned mode,
unsigned long flags = (unsigned long)key;
if (flags & POLLHUP) {
- remove_wait_queue_locked(event->wqh, &event->wait);
+ __remove_wait_queue(event->wqh, &event->wait);
spin_lock(&cgrp->event_list_lock);
list_del(&event->list);
spin_unlock(&cgrp->event_list_lock);
diff --git a/kernel/sched.c b/kernel/sched.c
index 39aa9c7..b531d79 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3983,8 +3983,7 @@ do_wait_for_common(struct completion *x, long timeout, int state)
if (!x->done) {
DECLARE_WAITQUEUE(wait, current);
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(&x->wait, &wait);
+ __add_wait_queue_tail_exclusive(&x->wait, &wait);
do {
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-05-11 18:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 6:33 [PATCH v2] wait: use wrapper functions Changli Gao
[not found] ` <1273214006-2979-1-git-send-email-xiaosuo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-05-07 10:12 ` Peter Zijlstra
2010-05-07 20:52 ` Andrew Morton
2010-05-07 20:52 ` Andrew Morton
2010-05-07 20:56 ` Peter Zijlstra
[not found] ` <20100507135220.a972a6b2.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2010-05-07 20:56 ` Peter Zijlstra
2010-05-11 18:30 ` [tip:sched/core] sched, wait: Use " tip-bot for Changli Gao
2010-05-07 10:12 ` [PATCH v2] wait: use " Peter Zijlstra
2010-05-11 18:30 ` [tip:sched/core] sched, wait: Use " tip-bot for Changli Gao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.