Re: [RFC] locking/mutex: Optimize __mutex_trylock_fast

From: Peter Zijlstra
Date: Thu Apr 05 2018 - 07:22:52 EST


On Thu, Apr 05, 2018 at 10:55:45AM +0100, Will Deacon wrote:

> > +#define atomic_long_try_cmpxchg_relaxed(l, old, new) \
> > + (ATOMIC_LONG_PFX(_try_cmpxchg_relaxed)((ATOMIC_LONG_PFX(_t) *)(l), \
> > + (ATOMIC_LONG_TYPE *)(old), (ATOMIC_LONG_TYPE)(new)))
>
> Are the casts on old and new strictly needed? We don't have them for the
> non-try versions...

It was required for the pointer; it doesn't want to convert (unsigned
long *) into (s64 *) without complaining about it :/