lkml.org 
[lkml]   [2006]   [Jan]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 5 Jan 2006 14:17:28 -0800 (PST)
FromLinus Torvalds <>
SubjectRe: [patch 00/21] mutex subsystem, -V14

On Thu, 5 Jan 2006, Ingo Molnar wrote:
>
> [ long details removed ]
> 
> to sum it up: atomic_dec/inc_return() alone is not enough to implement 
> critical sections, on a number of architectures. atomic_xchg() seems to 
> have similar problems too.

Yes.

> the patch below adds the smp_mb() barriers to the generic headers, which 
> should now fulfill all the ordering requirements, on every architecture.  
> It only relies on one property of the atomic primitives: that they wont 
> get reordered with respect to themselves, so an atomic_inc_ret() and an 
> atomic_dec_ret() cannot switch place.
> 
> Can you see any hole in this reasoning?

No. The alternative is to just make the ordering requirements 
for "atomic_dec_return()" and "atomic_xchg()" be absolute. Say that they 
have to be full memory barriers, and push the problem into the low-level
architecture.

I _think_ your patch is the right approach, because most architectures are 
likely to do their own fast-paths for mutexes, and as such the generic 
ones are more of a template for how to do it, and hopefilly aren't that 
performance critical.

			Linus
-
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-01-05 22:21    [from the cache]
©2003-2008