All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] epoll: use wrapper functions
@ 2010-05-06  1:57 Changli Gao
  2010-05-06  6:00 ` indiscriminate get_maintainer.pl usage (was [PATCH] epoll: use wrapper functions) Stefan Richter
  2010-05-06 18:47 ` [PATCH] epoll: use wrapper functions Davide Libenzi
  0 siblings, 2 replies; 45+ messages in thread
From: Changli Gao @ 2010-05-06  1:57 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexander Viro, Eric W. Biederman, Davide Libenzi, Roland Dreier,
	Stefan Richter, Ingo Molnar, Peter Zijlstra, Takashi Iwai,
	David Howells, linux-fsdevel, linux-kernel, Changli Gao

use wrapper functions.

epoll should not touch flags in wait_queue_t. This patch introduces a new
function add_wait_queue_head_exclusive_locked(), for the users, who use
wait queue as a LIFO queue.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 fs/eventpoll.c       |    5 ++---
 include/linux/wait.h |   15 +++++++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index bd056a5..8137f6e 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_head_exclusive_locked(&ep->wq, &wait);
 
 		for (;;) {
 			/*
@@ -1161,7 +1160,7 @@ retry:
 			jtimeout = schedule_timeout(jtimeout);
 			spin_lock_irqsave(&ep->lock, flags);
 		}
-		__remove_wait_queue(&ep->wq, &wait);
+		remove_wait_queue_locked(&ep->wq, &wait);
 
 		set_current_state(TASK_RUNNING);
 	}
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b..de2566d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -407,17 +407,28 @@ 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_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, and
+ * q must be for exclusive wait only.
+ */
+static inline void add_wait_queue_head_exclusive_locked(wait_queue_head_t *q,
+							wait_queue_t *wait)
+{
+	wait->flags |= WQ_FLAG_EXCLUSIVE;
+	__add_wait_queue(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)
+					    wait_queue_t *wait)
 {
 	__remove_wait_queue(q,  wait);
 }

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2010-05-13 16:22 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  1:57 [PATCH] epoll: use wrapper functions Changli Gao
2010-05-06  6:00 ` indiscriminate get_maintainer.pl usage (was [PATCH] epoll: use wrapper functions) Stefan Richter
     [not found]   ` <s2t412e6f7f1005052319sdbf3fdfbg256d11b983c4f304@mail.gmail.com>
2010-05-06  6:40     ` indiscriminate get_maintainer.pl usage Stefan Richter
2010-05-06 15:42       ` Davide Libenzi
2010-05-06 16:52         ` Joe Perches
2010-05-06 17:59           ` Davide Libenzi
2010-05-06 20:52             ` Joe Perches
2010-05-07  6:34               ` [PATCH] get_maintainer.pl: ignore non-maintainer tags florian
2010-05-07  6:39                 ` Joe Perches
2010-05-07  7:02                   ` Florian Mickler
2010-05-07 19:48                     ` Stefan Richter
2010-05-08 21:32                       ` [PATCH] get_maintainer.pl: optionally " florian
2010-05-08 21:39                         ` [PATCH] [RFC] get_maintainer.pl: only list maintainers by default florian
2010-05-08 22:44                           ` Joe Perches
2010-05-08 23:23                             ` Stefan Richter
2010-05-08 23:51                               ` Joe Perches
2010-05-09  0:22                                 ` Stefan Richter
2010-05-09  0:57                                   ` Joe Perches
2010-05-09  8:18                                     ` Stefan Richter
2010-05-09  8:41                                       ` Stefan Richter
2010-05-09  8:49                                     ` Florian Mickler
2010-05-09  9:12                                     ` Stefan Richter
2010-05-09  8:40                             ` Florian Mickler
2010-05-08 22:06                         ` [PATCH] get_maintainer.pl: optionally ignore non-maintainer tags Joe Perches
2010-05-09  9:15                           ` [PATCH v2] " florian
2010-05-09  9:35                             ` Stefan Richter
2010-05-10  4:56                             ` [PATCH 0/2] scripts/get_maintainer.pl: trivial improvements Joe Perches
2010-05-10  4:56                               ` [PATCH 1/2] scripts/get_maintainer.pl: optionally ignore non-maintainer signatures Joe Perches
2010-05-10  5:07                                 ` Florian Mickler
2010-05-11  6:36                                 ` [PATCH] scripts/get_maintainer.pl: default to not include unspecified tags florian
2010-05-11  7:48                                   ` Wolfram Sang
2010-05-11 15:59                                   ` Joe Perches
2010-05-11 16:33                                     ` Florian Mickler
2010-05-11 16:40                                       ` Joe Perches
2010-05-10  4:56                               ` [PATCH 2/2] scripts/get_maintainer.pl: add .get_maintainer.conf default options file Joe Perches
2010-05-12  6:30                                 ` Américo Wang
2010-05-12  9:25                                   ` Florian Mickler
2010-05-13 15:58                                     ` Américo Wang
2010-05-13 16:22                                       ` Joe Perches
2010-05-08 22:26                         ` [PATCH] " Joe Perches
2010-05-09  9:12                           ` Florian Mickler
2010-05-06 20:13       ` indiscriminate get_maintainer.pl usage Roland Dreier
2010-05-06 18:47 ` [PATCH] epoll: use wrapper functions Davide Libenzi
2010-05-06 18:51   ` Peter Zijlstra
2010-05-07  2:48     ` 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.