Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383247

Re: [RFC] arm64: Implement WFE based spin wait for MCS spinlocks

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC] arm64: Implement WFE based spin wait for MCS spinlocks
Date 2016-04-20 12:40 +0200
Message-ID <rpXI6-6qG-5@gated-at.bofh.it> (permalink)
References <rnJSW-6wh-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Apr 14, 2016 at 12:13:38AM -0700, Jason Low wrote:
> Use WFE to avoid most spinning with MCS spinlocks. This is implemented
> with the new cmpwait() mechanism for comparing and waiting for the MCS
> locked value to change using LDXR + WFE.
> 
> Signed-off-by: Jason Low <jason.low2@hp.com>
> ---
>  arch/arm64/include/asm/mcs_spinlock.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 arch/arm64/include/asm/mcs_spinlock.h
> 
> diff --git a/arch/arm64/include/asm/mcs_spinlock.h b/arch/arm64/include/asm/mcs_spinlock.h
> new file mode 100644
> index 0000000..d295d9d
> --- /dev/null
> +++ b/arch/arm64/include/asm/mcs_spinlock.h
> @@ -0,0 +1,21 @@
> +#ifndef __ASM_MCS_SPINLOCK_H
> +#define __ASM_MCS_SPINLOCK_H
> +
> +#define arch_mcs_spin_lock_contended(l)					\
> +do {									\
> +	int locked_val;							\
> +	for (;;) {							\
> +		locked_val = READ_ONCE(*l);				\
> +		if (locked_val)						\
> +			break;						\
> +		cmpwait(l, locked_val);					\
> +	}								\
> +	smp_rmb();							\
> +} while (0)

If you make the generic version use smp_cond_load_acquire() this isn't
needed.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [RFC] arm64: Implement WFE based spin wait for MCS spinlocks Peter Zijlstra <peterz@infradead.org> - 2016-04-20 12:40 +0200
  Re: [RFC] arm64: Implement WFE based spin wait for MCS spinlocks Jason Low <jason.low2@hp.com> - 2016-04-20 21:40 +0200

csiph-web