public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	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: Tue, 28 Oct 2008 23:29:24 -0700	[thread overview]
Message-ID: <1225261764.20276.7.camel@brick> (raw)
In-Reply-To: <20081029061827.GA7936@elte.hu>

On Wed, 2008-10-29 at 07:18 +0100, Ingo Molnar wrote:
> * Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > +#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
> 

Also is it possible to keep them as inlines in both the CONFIG_LOCK_KERNEL
and !CONFIG_LOCK_KERNEL

Something like (without checking if release_kernel_lock _can_ be an inline:

static inline void release_kernel_lock(struct task_struct *task)
{
#ifdef CONFIG_LOCK_KERNEL
	if (unlikely(task->lock_depth >= 0))
		__release_kernel_lock();
#endif
	return;
}

static inline int reacquire_kernel_lock(struct task_struct *task)
{
#ifdef CONFIG_LOCK_KERNEL
	if (unlikely(task->lock_depth >= 0))
		return __reacquire_kernel_lock();
#endif
	return 0;
}

Then the typechecking is kept in both CONFIG_LOCK_KERNEL/!CONFIG_LOCK_KERNEL

Cheers,

Harvey


  reply	other threads:[~2008-10-29  6:29 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   ` [PATCH 1/2] headers: move release_kernel_lock(), reacquire_kernel_lock() to sched.c Ingo Molnar
2008-10-29  6:29     ` Harvey Harrison [this message]
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=1225261764.20276.7.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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