public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: torvalds@osdl.org, viro@zeniv.linux.org.uk,
	acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] headers: move release_kernel_lock(), reacquire_kernel_lock() to sched.c
Date: Wed, 29 Oct 2008 07:18:27 +0100	[thread overview]
Message-ID: <20081029061827.GA7936@elte.hu> (raw)
In-Reply-To: <20081029044447.GB2304@x200.localdomain>


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

> >From 21b76c6e7d2340805664b91dc1c83eb23c6f785d Mon Sep 17 00:00:00 2001
> From: Alexey Dobriyan <adobriyan@gmail.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@gmail.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

  parent reply	other threads:[~2008-10-29  6:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29  4:43 [GIT] headers redux Alexey Dobriyan
2008-10-29  4:44 ` [PATCH 1/2] headers: move release_kernel_lock(), reacquire_kernel_lock() to sched.c Alexey Dobriyan
2008-10-29  4:45   ` [PATCH 2/2] headers: reduction in interrupt.h Alexey Dobriyan
2008-10-29  6:21     ` Ingo Molnar
2008-10-29  6:18   ` Ingo Molnar [this message]
2008-10-29  6:29     ` [PATCH 1/2] headers: move release_kernel_lock(), reacquire_kernel_lock() to sched.c Harvey Harrison
2008-10-29 10:04     ` Christoph Hellwig
2008-10-29 13:14       ` Alexey Dobriyan
2008-10-29 16:42         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081029061827.GA7936@elte.hu \
    --to=mingo@elte.hu \
    --cc=acme@ghostprotocols.net \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox