Messages in this thread | | | Date | Mon, 10 Feb 2014 14:59:46 -0800 | From | Andrew Morton <> | Subject | Re: [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().
| |