lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 10 Jun 2014 14:29:19 +0200
From:	Rasmus Villemoes <linux@...musvillemoes.dk>
To:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Rik van Riel <riel@...hat.com>,
	David Rientjes <rientjes@...gle.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Davidlohr Bueso <davidlohr@...com>,
	Michal Simek <michal.simek@...inx.com>
Cc:	linux-kernel@...r.kernel.org,
	Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: [PATCH 2/2] wait: Use the per-task wait_queue_t in ___wait_event macro

The ___wait_event macro satisfies the requirements for making use of
the per-task wait_queue_t, so use it. This should make the stack
footprint of all users of the wait_event_* macros smaller.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 include/linux/wait.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 94279be..5f51252 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -207,17 +207,17 @@ wait_queue_head_t *bit_waitqueue(void *, int);
 #define ___wait_event(wq, condition, state, exclusive, ret, cmd)	\
 ({									\
 	__label__ __out;						\
-	wait_queue_t __wait;						\
+	wait_queue_t *__wait = current_wq_get();			\
 	long __ret = ret;	/* explicit shadow */			\
 									\
-	INIT_LIST_HEAD(&__wait.task_list);				\
+	INIT_LIST_HEAD(&__wait->task_list);				\
 	if (exclusive)							\
-		__wait.flags = WQ_FLAG_EXCLUSIVE;			\
+		__wait->flags = WQ_FLAG_EXCLUSIVE;			\
 	else								\
-		__wait.flags = 0;					\
+		__wait->flags = 0;					\
 									\
 	for (;;) {							\
-		long __int = prepare_to_wait_event(&wq, &__wait, state);\
+		long __int = prepare_to_wait_event(&wq, __wait, state);	\
 									\
 		if (condition)						\
 			break;						\
@@ -225,7 +225,7 @@ wait_queue_head_t *bit_waitqueue(void *, int);
 		if (___wait_is_interruptible(state) && __int) {		\
 			__ret = __int;					\
 			if (exclusive) {				\
-				abort_exclusive_wait(&wq, &__wait,	\
+				abort_exclusive_wait(&wq, __wait,	\
 						     state, NULL);	\
 				goto __out;				\
 			}						\
@@ -234,8 +234,9 @@ wait_queue_head_t *bit_waitqueue(void *, int);
 									\
 		cmd;							\
 	}								\
-	finish_wait(&wq, &__wait);					\
-__out:	__ret;								\
+	finish_wait(&wq, __wait);					\
+__out:	current_wq_put(__wait);						\
+	__ret;								\
 })
 
 #define __wait_event(wq, condition)					\
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ