Re: Is gcc thread-unsafe?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Nick Piggin
Date: Wednesday, October 24, 2007 - 9:47 pm

Hi David,

[BTW. can you retain cc lists, please?]

On Thursday 25 October 2007 14:29, David Schwartz wrote:

A *conditional* store should no be a problem.

However the funny trick of doing this conditional add (implemented with
unconditional store), is what is going to cause breakage.

On the CPUs where predicated instructions are a big win, I'd expect
they should also implement a conditional store for use here. However
they might be slower than an unconditional store (eg. x86's cmov),
and in those cases, gcc might just do the non-conditional store.



This is not just a question of data that you were going to use anyway.
gcc generates memory accesses to locations that would never be accessed
Even stores. It is basically impossible to say that this is a real
performance win. Even on single threaded code: consider that cache
misses take the vast majority of time in many loads, which gives a
little hint that maybe it's a bad idea to do this ;)



I'd never say the optimisation would always be useless. But it's a nasty
thing to have on by default, and apparently even with no good way to
supress it even if we want to.



Either way, I think we really need a way to turn it off for Linux.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Is gcc thread-unsafe?, Nick Piggin, (Wed Oct 24, 8:24 pm)
Re: Is gcc thread-unsafe?, Arjan van de Ven, (Wed Oct 24, 8:46 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Wed Oct 24, 8:58 pm)
RE: Is gcc thread-unsafe?, David Schwartz, (Wed Oct 24, 9:29 pm)
Re: Is gcc thread-unsafe?, Arjan van de Ven, (Wed Oct 24, 9:35 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Wed Oct 24, 9:47 pm)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 12:15 am)
Re: Is gcc thread-unsafe?, Samuel Tardieu, (Thu Oct 25, 2:44 am)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 2:55 am)
Re: Is gcc thread-unsafe?, linux-os (Dick Johnson), (Thu Oct 25, 4:58 am)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 5:16 am)
Re: Is gcc thread-unsafe?, Linus Torvalds, (Thu Oct 25, 7:55 am)
Re: Is gcc thread-unsafe?, Pekka Enberg, (Thu Oct 25, 8:12 am)
RE: Is gcc thread-unsafe?, David Schwartz, (Thu Oct 25, 2:42 pm)
Re: Is gcc thread-unsafe?, Ismail , (Thu Oct 25, 3:26 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Thu Oct 25, 3:49 pm)
Re: Is gcc thread-unsafe?, Jeff Garzik, (Thu Oct 25, 3:56 pm)
Re: Is gcc thread-unsafe?, Jeff Garzik, (Thu Oct 25, 4:04 pm)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 4:09 pm)
Re: Is gcc thread-unsafe?, Linus Torvalds, (Thu Oct 25, 4:14 pm)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 4:16 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Thu Oct 25, 4:22 pm)
Re: Is gcc thread-unsafe?, Linus Torvalds, (Thu Oct 25, 4:32 pm)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 4:42 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Thu Oct 25, 4:43 pm)
Re: Is gcc thread-unsafe?, Andi Kleen, (Thu Oct 25, 4:55 pm)
Re: Is gcc thread-unsafe?, Nick Piggin, (Thu Oct 25, 4:57 pm)
Re: Is gcc thread-unsafe?, Linus Torvalds, (Thu Oct 25, 4:57 pm)
Re: Is gcc thread-unsafe?, Zachary Amsden, (Thu Oct 25, 6:15 pm)
Re: Is gcc thread-unsafe?, Willy Tarreau, (Thu Oct 25, 9:57 pm)
Re: Is gcc thread-unsafe?, Andrew Haley, (Fri Oct 26, 4:59 am)
Re: Is gcc thread-unsafe?, Andrew Haley, (Fri Oct 26, 4:59 am)
Re: Is gcc thread-unsafe?, Chris Friesen, (Fri Oct 26, 10:39 am)
Re: Is gcc thread-unsafe?, Phillip Susi, (Wed Oct 31, 3:10 pm)