Re: [PATCH 1/2] headers: move release_kernel_lock(),reacquire_kernel_lock() to sched.c

From: Harvey Harrison
Date: Wed Oct 29 2008 - 02:29:38 EST


On Wed, 2008-10-29 at 07:18 +0100, Ingo Molnar wrote:
> * Alexey Dobriyan <adobriyan@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/