Messages in this thread | | | Date | Tue, 31 Oct 2006 10:49:38 +0100 | From | Jens Axboe <> | Subject | Re: [PATCH] splice : two smp_mb() can be omitted |
| |
On Tue, Oct 31 2006, Nick Piggin wrote: > Eric Dumazet wrote: > >This patch deletes two calls to smp_mb() that were done after > >mutex_unlock() that contains an implicit memory barrier. > > Uh, there is nothing that says mutex_unlock or any unlock > functions contain an implicit smp_mb(). What is given is that the > lock and unlock obey aquire and release memory ordering, > respectively. > > a = x; > xxx_unlock > b = y; > > In this situation, the load of y can be executed before that of x. > And some architectures will even do so (i386 can, because the > unlock is an unprefixed store; ia64 can, because it uses a release > barrier in the unlock). > > Whenever you rely on orderings of things *outside* locks (even > partially outside), you do need to be very careful about barriers > and can't rely on locks to do the right thing for you.
Good point, we should not make any assumptions on the way the architecture implements the mutexes.
-- Jens Axboe
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |