[ltt-dev] [PATCH 1/3] Fix the "unknown" case
Paolo Bonzini
pbonzini at redhat.com
Mon Jun 14 12:51:30 EDT 2010
On 06/14/2010 02:41 AM, Paul E. McKenney wrote:
> The compiler (and sometimes the CPU) are within their rights to move
> code into a lock-based critical section. With two
> locks:
>
> do_first_thing();
> acquire_lock();
> release_lock();
> acquire_lock();
> release_lock();
> do_second_thing();
>
> the worst that the compiler and CPU can do is:
>
> acquire_lock();
> do_first_thing();
> release_lock();
> acquire_lock();
> do_second_thing();
> release_lock();
>
> which is still acting like a memory barrier.
Interesting, so it's actually the release+acquire that is doing the job.
I thought about barrier+acquire+release+barrier, but that would
placate the compiler only, not the CPU.
Paolo
More information about the lttng-dev
mailing list