Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb344389 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull a mutex fix from Ingo Molnar.

Fix the fastpath_lock failure contention flag for xchg-based mutexes.

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  mutex: Place lock in contended state after fastpath_lock failure
parents 0e665d5d 0bce9c46
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -26,6 +26,12 @@ static inline void
__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
	if (unlikely(atomic_xchg(count, 0) != 1))
		/*
		 * We failed to acquire the lock, so mark it contended
		 * to ensure that any waiting tasks are woken up by the
		 * unlock slow path.
		 */
		if (likely(atomic_xchg(count, -1) != 1))
			fail_fn(count);
}

@@ -43,6 +49,7 @@ static inline int
__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
{
	if (unlikely(atomic_xchg(count, 0) != 1))
		if (likely(atomic_xchg(count, -1) != 1))
			return fail_fn(count);
	return 0;
}