Re: [RFC PATCH] introduce sys_membarrier(): process-wide memorybarrier (v5)

From: Steven Rostedt
Date: Thu Jan 21 2010 - 11:12:27 EST


On Thu, 2010-01-21 at 11:07 -0500, Mathieu Desnoyers wrote:
> * Peter Zijlstra (peterz@xxxxxxxxxxxxx) wrote:

> We can even create a generic fallback with the following kind of code in
> the meantime:
>
> static inline void spin_lock_mb(spinlock_t *lock)
> {
> spin_lock(&lock);

That would be spin_lock(lock);

> smp_mb();
> }
>
> static inline void spin_unlock_mb(spinlock_t *lock)
> {
> smp_mb();
> spin_unlock(&lock);

and spin_unlock(lock);

;-)

> }
>
> How does that sound ?

You may also need spin_lock_irqsave, et al. variants too.

-- Steve


--
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/