- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb64d92f
committed
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomicoperations. This new API avoids the need to splatter compiler andarchitecture dependent code over all the locations employing atomicops.For several of the potential usages it'd be problematic to maintainboth, a atomics using implementation and one using spinlocks orsimilar. In all likelihood one of the implementations would not gettested regularly under concurrency. To avoid that scenario the new APIprovides a automatic fallback of atomic operations to spinlocks. Allproperties of atomic operations are maintained. This fallback -obviously - isn't as fast as just using atomic ops, but it's not badeither. For one of the future users the atomics ontop spinlocksimplementation was actually slightly faster than the old purelyspinlock using implementation. That's important because it reduces thefear of regressing older platforms when improving the scalability fornew ones.The API, loosely modeled after the C11 atomics support, currentlyprovides 'atomic flags' and 32 bit unsigned integers. If the platformefficiently supports atomic 64 bit unsigned integers those are alsoprovided.To implement atomics support for a platform/architecture/compiler fora type of atomics 32bit compare and exchange needs to beimplemented. If available and more efficient native support for flags,32 bit atomic addition, and corresponding 64 bit operations may alsobe provided. Additional useful atomic operations are implementedgenerically ontop of these.The implementation for various versions of gcc, msvc and sun studio havebeen tested. Additional existing stub implementations for* Intel icc* HUPX acc* IBM xlcare included but have never been tested. These will likely requirefixes based on buildfarm and user feedback.As atomic operations also require barriers for some operations theexisting barrier support has been moved into the atomics code.Author: Andres Freund with contributions from Oskari SaarenmaaReviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro HerreraDiscussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com, 20131015123303.GH5300@awork2.anarazel.de, 20131028205522.GI20248@awork2.anarazel.de1 parent9111d46 commitb64d92f
File tree
31 files changed
+2816
-208
lines changed- config
- src
- backend
- main
- port
- storage/lmgr
- include
- port
- atomics
- storage
- test/regress
- expected
- input
- output
- sql
31 files changed
+2816
-208
lines changedLines changed: 98 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + |
0 commit comments
Comments
(0)