public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3/7] epoll keyed wakeups - introduce key-aware wakeup macros
@ 2009-01-31  3:25 Davide Libenzi
  2009-01-31  3:30 ` Ingo Molnar
  2009-01-31  3:49 ` Linus Torvalds
  0 siblings, 2 replies; 13+ messages in thread
From: Davide Libenzi @ 2009-01-31  3:25 UTC (permalink / raw)
  To: Linux Kernel Mailing List
  Cc: Andrew Morton, Linus Torvalds, Alan Cox, Ingo Molnar,
	David Miller

The following patch introduces new kwake_* macros that accepts an
extra key parameter to be specified in the wakeup.
I chose to add an initial 'k' to the original names, instead of adding
a whole "_key", since the name of some of those macros is becoming
awfully long. No problem in using the "_key" naming, if others feel it.
Comments?



Signed-off-by: Davide Libenzi <davidel@xmailserver.org>


- Davide


---
 include/linux/wait.h |   41 +++++++++++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 12 deletions(-)

Index: linux-2.6.mod/include/linux/wait.h
===================================================================
--- linux-2.6.mod.orig/include/linux/wait.h	2009-01-30 12:11:42.000000000 -0800
+++ linux-2.6.mod/include/linux/wait.h	2009-01-30 12:11:44.000000000 -0800
@@ -144,31 +144,48 @@ int out_of_line_wait_on_bit(void *, int,
 int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
 wait_queue_head_t *bit_waitqueue(void *, int);
 
-#define wake_up(x)			__wake_up(x, TASK_NORMAL, 1, NULL)
-#define wake_up_nr(x, nr)		__wake_up(x, TASK_NORMAL, nr, NULL)
-#define wake_up_all(x)			__wake_up(x, TASK_NORMAL, 0, NULL)
-#define wake_up_locked(x)		__wake_up_locked((x), TASK_NORMAL, NULL)
-
-#define wake_up_interruptible(x)	__wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
-#define wake_up_interruptible_nr(x, nr)	__wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
-#define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
-#define wake_up_interruptible_sync(x)	__wake_up_sync((x), TASK_INTERRUPTIBLE, 1, \
-						       NULL)
+#define kwake_up(x, k)			__wake_up(x, TASK_NORMAL, 1, (void *) (k))
+#define kwake_up_nr(x, nr, k)		__wake_up(x, TASK_NORMAL, nr, (void *) (k))
+#define kwake_up_all(x, k)		__wake_up(x, TASK_NORMAL, 0, (void *) (k))
+#define kwake_up_locked(x, k)		__wake_up_locked((x), TASK_NORMAL, \
+						(void *) (k))
+
+#define kwake_up_interruptible(x, k)	__wake_up(x, TASK_INTERRUPTIBLE, 1, \
+						(void *) (k))
+#define kwake_up_interruptible_nr(x, nr, k)	__wake_up(x, TASK_INTERRUPTIBLE, nr, \
+						(void *) (k))
+#define kwake_up_interruptible_all(x, k)	__wake_up(x, TASK_INTERRUPTIBLE, 0, \
+						(void *) (k))
+#define kwake_up_interruptible_sync(x, k)	__wake_up_sync((x), TASK_INTERRUPTIBLE, \
+						1, (void *) (k))
+
+#define wake_up(x)			kwake_up(x, NULL)
+#define wake_up_nr(x, nr)		kwake_up_nr(x, nr, NULL)
+#define wake_up_all(x)			kwake_up_all(x, NULL)
+#define wake_up_locked(x)		kwake_up_locked(x, NULL)
+
+#define wake_up_interruptible(x)	kwake_up_interruptible(x, NULL)
+#define wake_up_interruptible_nr(x, nr)	kwake_up_interruptible_nr(x, nr, NULL)
+#define wake_up_interruptible_all(x)	kwake_up_interruptible_all(x, NULL)
+#define wake_up_interruptible_sync(x)	kwake_up_interruptible_sync(x, NULL)
+
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 /*
  * macro to avoid include hell
  */
-#define wake_up_nested(x, s)						\
+#define kwake_up_nested(x, s, k)					\
 do {									\
 	unsigned long flags;						\
 									\
 	spin_lock_irqsave_nested(&(x)->lock, flags, (s));		\
-	wake_up_locked(x); 						\
+	kwake_up_locked(x, k); 						\
 	spin_unlock_irqrestore(&(x)->lock, flags);			\
 } while (0)
+#define wake_up_nested(x, s)		kwake_up_nested(x, s, NULL)
 #else
 #define wake_up_nested(x, s)		wake_up(x)
+#define kwake_up_nested(x, k, s)	kwake_up(x, k)
 #endif
 
 #define __wait_event(wq, condition) 					\


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

end of thread, other threads:[~2009-01-31 21:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31  3:25 [patch 3/7] epoll keyed wakeups - introduce key-aware wakeup macros Davide Libenzi
2009-01-31  3:30 ` Ingo Molnar
2009-01-31  3:50   ` Davide Libenzi
2009-01-31  3:57   ` Linus Torvalds
2009-01-31 13:06     ` Ingo Molnar
2009-01-31 18:57       ` Davide Libenzi
2009-01-31  9:25   ` Alan Cox
2009-01-31 19:03     ` Davide Libenzi
2009-01-31  3:49 ` Linus Torvalds
2009-01-31  4:01   ` Davide Libenzi
2009-01-31  4:57   ` wli
2009-01-31 19:08     ` Davide Libenzi
2009-01-31 21:28       ` wli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox