Re: [PATCH [RT] 11/14] optimize the !printk fastpath through the lock acquisition

From: Pavel Machek
Date: Fri Feb 22 2008 - 14:23:01 EST


Hi!

> Decorate the printk path with an "unlikely()"
>
> Signed-off-by: Gregory Haskins <ghaskins@xxxxxxxxxx>
> ---
>
> kernel/rtmutex.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
> index 122f143..ebdaa17 100644
> --- a/kernel/rtmutex.c
> +++ b/kernel/rtmutex.c
> @@ -660,12 +660,12 @@ rt_spin_lock_fastlock(struct rt_mutex *lock,
> void fastcall (*slowfn)(struct rt_mutex *lock))
> {
> /* Temporary HACK! */
> - if (!current->in_printk)
> - might_sleep();
> - else if (in_atomic() || irqs_disabled())
> + if (unlikely(current->in_printk) && (in_atomic() || irqs_disabled()))
> /* don't grab locks for printk in atomic */
> return;
>
> + might_sleep();

I think you changed the code here... you call might_sleep() in
different cases afaict.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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/