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]
Message-ID: <20081029044447.GB2304@x200.localdomain>
Date:	Wed, 29 Oct 2008 07:44:47 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	torvalds@...l.org
Cc:	viro@...iv.linux.org.uk, acme@...stprotocols.net,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] headers: move release_kernel_lock(),
	reacquire_kernel_lock() to sched.c

>From 21b76c6e7d2340805664b91dc1c83eb23c6f785d Mon Sep 17 00:00:00 2001
From: Alexey Dobriyan <adobriyan@...il.com>
Date: Mon, 27 Oct 2008 00:57:28 +0300
Subject: [PATCH 1/2] headers: move release_kernel_lock(), reacquire_kernel_lock() to sched.c

Both are used only by scheduler, both are low-level enough to not allow in
drivers. Removal allows to remove sched.h from smp_lock.h, which is needed
solely for inline function.

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 include/linux/smp_lock.h |   18 ------------------
 kernel/sched.c           |   20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 813be59..6052f02 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -8,22 +8,6 @@
 
 extern int __lockfunc __reacquire_kernel_lock(void);
 extern void __lockfunc __release_kernel_lock(void);
-
-/*
- * Release/re-acquire global kernel lock for the scheduler
- */
-#define release_kernel_lock(tsk) do { 		\
-	if (unlikely((tsk)->lock_depth >= 0))	\
-		__release_kernel_lock();	\
-} while (0)
-
-static inline int reacquire_kernel_lock(struct task_struct *task)
-{
-	if (unlikely(task->lock_depth >= 0))
-		return __reacquire_kernel_lock();
-	return 0;
-}
-
 extern void __lockfunc lock_kernel(void)	__acquires(kernel_lock);
 extern void __lockfunc unlock_kernel(void)	__releases(kernel_lock);
 
@@ -43,9 +27,7 @@ static inline void cycle_kernel_lock(void)
 
 #define lock_kernel()				do { } while(0)
 #define unlock_kernel()				do { } while(0)
-#define release_kernel_lock(task)		do { } while(0)
 #define cycle_kernel_lock()			do { } while(0)
-#define reacquire_kernel_lock(task)		0
 #define kernel_locked()				1
 
 #endif /* CONFIG_LOCK_KERNEL */
diff --git a/kernel/sched.c b/kernel/sched.c
index 6625c3c..96a4462 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -79,6 +79,26 @@
 
 #include "sched_cpupri.h"
 
+#ifdef CONFIG_LOCK_KERNEL
+/*
+ * Release/re-acquire global kernel lock for the scheduler
+ */
+#define release_kernel_lock(tsk) do { 		\
+	if (unlikely((tsk)->lock_depth >= 0))	\
+		__release_kernel_lock();	\
+} while (0)
+
+static inline int reacquire_kernel_lock(struct task_struct *task)
+{
+	if (unlikely(task->lock_depth >= 0))
+		return __reacquire_kernel_lock();
+	return 0;
+}
+#else
+#define release_kernel_lock(task)		do { } while(0)
+#define reacquire_kernel_lock(task)		0
+#endif
+
 /*
  * Convert user-nice values [ -20 ... 0 ... 19 ]
  * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
-- 
1.5.6.5

--
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