forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit450c7de
committed
Remove volatiles from {procarray,volatile}.c and fix memory ordering issue.
The use of volatiles in procarray.c largely originated from the timewhen postgres did not have reliable compiler and memorybarriers. That's not the case anymore, so we can do better.Several of the functions in procarray.c can be bottlenecks, andremoval of volatile yields mildly better code.The new state, with explicit memory barriers, is also morecorrect. The previous use of volatile did not actually deliversufficient guarantees on weakly ordered machines, in particular thelogic in GetNewTransactionId() does not look safe. It seems unlikelyto be a problem in practice, but worth fixing.Thomas and I independently wrote a patch for this.Reported-By: Andres Freund and Thomas MunroAuthor: Andres Freund, with cherrypicked changes from a patch by Thomas MunroDiscussion:https://postgr.es/m/20181005172955.wyjb4fzcdzqtaxjq@alap3.anarazel.dehttps://postgr.es/m/CAEepm=1nff0x=7i3YQO16jLA2qw-F9O39YmUew4oq-xcBQBs0g@mail.gmail.com1 parent69ee2ff commit450c7de
2 files changed
+108
-99
lines changedLines changed: 22 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
186 | 186 |
| |
187 | 187 |
| |
188 | 188 |
| |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 | 189 |
| |
195 | 190 |
| |
196 |
| - | |
| 191 | + | |
| 192 | + | |
197 | 193 |
| |
198 | 194 |
| |
199 | 195 |
| |
200 |
| - | |
201 |
| - | |
202 |
| - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
203 | 206 |
| |
204 | 207 |
| |
205 | 208 |
| |
| |||
211 | 214 |
| |
212 | 215 |
| |
213 | 216 |
| |
| 217 | + | |
| 218 | + | |
| 219 | + | |
214 | 220 |
| |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
| 221 | + | |
224 | 222 |
| |
225 |
| - | |
226 |
| - | |
227 |
| - | |
| 223 | + | |
228 | 224 |
| |
229 |
| - | |
230 |
| - | |
231 |
| - | |
232 |
| - | |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 |
| - | |
237 |
| - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
238 | 228 |
| |
| 229 | + | |
| 230 | + | |
239 | 231 |
| |
240 | 232 |
| |
241 | 233 |
| |
|
0 commit comments
Comments
(0)