Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock

Eric Dumazet
2009-07-07T15:24:20Z

Mathieu Desnoyers a écrit :

> But read_lock + smp_mb__after_lock + read_unlock is not well suited for
> powerpc, arm, mips and probably others where there is an explicit memory
> barrier at the end of the read lock primitive.
>
> One thing that would be efficient for all architectures is to create a
> locking primitive that contains the smp_mb, e.g.:
>
> read_lock_smp_mb()
>
> which would act as a read_lock which does a full smp_mb after the lock
> is taken.
>
> The naming may be a bit odd, better ideas are welcome.

I see your point now, thanks for your patience.

Jiri, I think your first patch can be applied (including the full smp_mb()),
then we will optimize both for x86 and other arches, when all
arch maintainers have a chance to change
"read_lock();smp_mb()" to a faster "read_lock_mb()" or something :)