lkml.org 
[lkml]   [2006]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2006-10-31 10:51    [W:0.222 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site