Re: spinlocks on HP-UX
От | Greg Stark |
---|---|
Тема | Re: spinlocks on HP-UX |
Дата | |
Msg-id | CAM-w4HMrD+kp0Qh_DE9MtERw1BWHaXc8V-gfkHnAP=bA__QcOg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: spinlocks on HP-UX (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: spinlocks on HP-UX
|
Список | pgsql-hackers |
On Mon, Aug 29, 2011 at 5:53 PM, Robert Haas <robertmhaas@gmail.com> wrote: > Even though the compiler may emit those instructions in exactly that > order, an x86 CPU can, IIUC, decide to load B before it finishes > storing A, so that the actual apparent execution order as seen by > other CPUs will be either the above, or the above with the last two > instructions reversed. On a weakly ordered CPU, the load of B could > be moved back even further, before the LOAD of A. My understanding of what the comment meant is that there is already a full memory barrier as far as the CPU is concerned due to the TAS or whatever, but it's important that there also be a sequence point there so that the volatile memory access isn't reordered by the compiler to occur before the memory barrier. I was going to say the same thing as Tom that sequence points and volatile pointers have nothing at all to do with each other. However my brief searching online actually seemed to indicate that in fact the compiler isn't supposed to reorder volatile memory accesses across sequence points. That seemed to make sense since I couldn't think of any other way to rigorously describe the constraints the compiler should operate under. -- greg
В списке pgsql-hackers по дате отправления: