Re: [patch 1/2] Directed yield: cpu_relax variants for spinlocks and rw-locks.

Paul Mackerras
2006-09-15T11:59:14Z

Martin Schwidefsky writes:

> In order to implement a spinlock that yields the cpu in favour of
> the current lock holder cpu_relax variants for spinlocks and
> read/write locks are needed. The new _raw_spin_relax, _raw_read_relax
> and _raw_write_relax primitives have an additional argument: the
> pointer to the lock structure.

This will be useful on powerpc as well. We need:

#define _raw_spin_relax(lock) __spin_yield(lock)
#define _raw_read_relax(lock) __rw_yield(lock)
#define _raw_write_relax(lock) __rw_yield(lock)

in order to define your new primitives in terms of what we already
have defined in asm-powerpc/spinlock.h.

Thanks,
Paul.