Re: [PATCH 1/2] percpu-rw-semaphores: use light/heavy barriers

From: Peter Zijlstra
Date: Tue Oct 23 2012 - 16:33:33 EST


On Mon, 2012-10-22 at 19:37 -0400, Mikulas Patocka wrote:
> - /*
> - * On X86, write operation in this_cpu_dec serves as a memory unlock
> - * barrier (i.e. memory accesses may be moved before the write, but
> - * no memory accesses are moved past the write).
> - * On other architectures this may not be the case, so we need smp_mb()
> - * there.
> - */
> -#if defined(CONFIG_X86) && (!defined(CONFIG_X86_PPRO_FENCE) && !defined(CONFIG_X86_OOSTORE))
> - barrier();
> -#else
> - smp_mb();
> -#endif
> + light_mb(); /* B, between read of the data and write to p->counter, paired with C */

If we're going to invent new primitives for this, shouldn't we call
this: smp_unlock_barrier() or something? That at least has well defined
semantics.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/