All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] locking/mutex: Enable optimistic spinning of lock waiter
@ 2016-07-18 20:39 Waiman Long
  2016-07-18 20:39 ` [PATCH v4 1/3] locking/mutex: Add waiter parameter to mutex_optimistic_spin() Waiman Long
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Waiman Long @ 2016-07-18 20:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, linux-kernel, Linus Torvalds, Ding Tianhong,
	Jason Low, Davidlohr Bueso, Paul E. McKenney, Thomas Gleixner,
	Will Deacon, Tim Chen, Imre Deak, Waiman Long

v3->v4:
 - Replace patch 3 by a new one to add a flag to ensure forward
   progress of the waiter-spinner.

v2->v3:
 - Remove patch 4 as it is not useful.
 - Allow need_resched() check for waiter & add more comments about
   changes to address issues raised by PeterZ.

v1->v2:
 - Set task state to running before doing optimistic spinning.
 - Add 2 more patches to handle possible missed wakeups and wasteful
   spinning in try_to_wake_up() function.

This patchset is a variant of PeterZ's "locking/mutex: Avoid spinner
vs waiter starvation" patch. The major difference is that the
waiter-spinner won't enter into the OSQ used by the spinners. Instead,
it will spin directly on the lock in parallel with the queue head
of the OSQ. So there may be a bit more cacheline contention on the
lock cacheline, but that shouldn't cause noticeable impact on system
performance.

This patchset tries to address 2 issues with Peter's patch:

 1) Ding Tianhong still find that hanging task could happen in some cases.
 2) Jason Low found that there was performance regression for some AIM7
    workloads.

By making the waiter-spinner to spin directly on the mutex, it will
increase the chance for the waiter-spinner to get the lock instead
of waiting in the OSQ for its turn.

Patch 1 modifies the mutex_optimistic_spin() function to enable it
to be called by a waiter-spinner that doesn't need to go into the OSQ.

Patch 2 modifies the mutex locking slowpath to make the waiter call
mutex_optimistic_spin() to do spinning after being waken up.

Patch 3 adds a new flag to give priority to the waiter-spinner to
acquire the lock, thus ensuring forward progress.

Waiman Long (3):
  locking/mutex: Add waiter parameter to mutex_optimistic_spin()
  locking/mutex: Enable optimistic spinning of woken task in wait queue
  locking/mutex: Ensure forward progress of waiter-spinner

 include/linux/mutex.h  |    1 +
 kernel/locking/mutex.c |  116 ++++++++++++++++++++++++++++++++++++------------
 2 files changed, 88 insertions(+), 29 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-08-10 19:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 20:39 [PATCH v4 0/3] locking/mutex: Enable optimistic spinning of lock waiter Waiman Long
2016-07-18 20:39 ` [PATCH v4 1/3] locking/mutex: Add waiter parameter to mutex_optimistic_spin() Waiman Long
2016-08-08 17:26   ` Peter Zijlstra
2016-08-09 17:36     ` Waiman Long
2016-07-18 20:39 ` [PATCH v4 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue Waiman Long
2016-08-08 17:29   ` Peter Zijlstra
2016-08-09 17:49     ` Waiman Long
2016-07-18 20:39 ` [PATCH v4 3/3] locking/mutex: Ensure forward progress of waiter-spinner Waiman Long
2016-08-08 17:37   ` Peter Zijlstra
2016-08-09 18:00     ` Waiman Long
2016-08-10  9:29       ` Peter Zijlstra
2016-08-10 17:51         ` Waiman Long

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.