On Mon, 10 Feb 2014 20:58:26 +0100 Peter Zijlstra <pet...@infradead.org> wrote:

> Add in an extra reschedule in an attempt to avoid getting reschedule
> the moment we've acquired the lock.
> 
> ...
>
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -468,6 +468,13 @@ __mutex_lock_common(struct mutex *lock,
>       }
>       osq_unlock(&lock->osq);
>  slowpath:
> +     /*
> +      * If we fell out of the spin path because of need_resched(),
> +      * reschedule now, before we try-lock the mutex. This avoids getting
> +      * scheduled out right after we obtained the mutex.
> +      */
> +     if (unlikely(need_resched()))
> +             schedule_preempt_disabled();

need_resched() already does unlikely().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to