lkml.org 
[lkml]   [2014]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/8] mutex: Extra reschedule point
On Mon, 10 Feb 2014 20:58:26 +0100 Peter Zijlstra <peterz@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().


\
 
 \ /
  Last update: 2014-02-11 00:41    [W:0.202 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site