Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

From: Waiman Long
Date: Fri Aug 26 2016 - 19:41:13 EST


On 08/26/2016 11:18 AM, Peter Zijlstra wrote:
On Fri, Aug 26, 2016 at 10:30:31AM -0400, Waiman Long wrote:
On 08/25/2016 06:23 PM, Peter Zijlstra wrote:
You're right.. I'll try again tomorrow.
Actually, it is also OK to handoff from NULL=>new, but nothing else is
appropriate.
I pushed out new patches to git, could you have a peek?

- killed another of that mutex abuse
- fixed ATOMIC_FETCH_OP for SH4
- split: rm arch/*/include/asm/mutex*.h include/asm-generic/mutex*.h
into a separate patch to aid in review
- fixed lockdep
- added an uncontended unlock fast path, to mirror the unconteded lock
fast path
- reworked the handoff stuff (again)

I didn't try and be too clever, since its far too hot to think.

Still need to look at adding spinning to the handoff case.
Also need to look at writing (much) better changelogs, they stink.


I have looked at the handoff code and I didn't see any problem.

BTW, I also sent out a patch to add optimistic spinning to the waiter. Please let me know your thought on that.

Thanks,
Longman