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: <20081029061827.GA7936@elte.hu>
Date:	Wed, 29 Oct 2008 07:18:27 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	torvalds@...l.org, viro@...iv.linux.org.uk,
	acme@...stprotocols.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] headers: move release_kernel_lock(),
	reacquire_kernel_lock() to sched.c


* Alexey Dobriyan <adobriyan@...il.com> wrote:

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

please dont move #ifdefs and interfaces into a .c file - if then move 
it into another header file.

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