[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225261764.20276.7.camel@brick>
Date: Tue, 28 Oct 2008 23:29:24 -0700
From: Harvey Harrison <harvey.harrison@...il.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Alexey Dobriyan <adobriyan@...il.com>, 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
On Wed, 2008-10-29 at 07:18 +0100, Ingo Molnar wrote:
> * Alexey Dobriyan <adobriyan@...il.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
--
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