forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfd49d53
committed
Avoid potential spinlock in a signal handler as part of global barriers.
On platforms without support for 64bit atomic operations where we alsocannot rely on 64bit reads to have single copy atomicity, such atomicsare implemented using a spinlock based fallback. That means it's notsafe to even read such atomics from within a signal handler (since thesignal handler might run when the spinlock already is held).To avoid this issue defer global barrier processing out of the signalhandler. Instead of checking local / shared barrier generation todetermine whether to set ProcSignalBarrierPending, introducePROCSIGNAL_BARRIER and always set ProcSignalBarrierPending whenreceiving such a signal. Additionally avoid redundant work inProcessProcSignalBarrier if ProcSignalBarrierPending is unnecessarily.Also do a small amount of other polishing.Author: Andres FreundReviewed-By: Robert HaasDiscussion:https://postgr.es/m/20200609193723.eu5ilsjxwdpyxhgz@alap3.anarazel.deBackpatch: 13-, where the code was introduced.1 parent2fd2eff commitfd49d53
File tree
2 files changed
+52
-36
lines changed- src
- backend/storage/ipc
- include/storage
2 files changed
+52
-36
lines changedLines changed: 51 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
320 | 320 |
| |
321 | 321 |
| |
322 | 322 |
| |
323 |
| - | |
| 323 | + | |
324 | 324 |
| |
325 | 325 |
| |
326 | 326 |
| |
| |||
363 | 363 |
| |
364 | 364 |
| |
365 | 365 |
| |
| 366 | + | |
| 367 | + | |
| 368 | + | |
366 | 369 |
| |
| 370 | + | |
367 | 371 |
| |
368 | 372 |
| |
369 | 373 |
| |
| |||
383 | 387 |
| |
384 | 388 |
| |
385 | 389 |
| |
| 390 | + | |
| 391 | + | |
386 | 392 |
| |
387 | 393 |
| |
388 | 394 |
| |
| |||
417 | 423 |
| |
418 | 424 |
| |
419 | 425 |
| |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
420 | 443 |
| |
421 | 444 |
| |
422 | 445 |
| |
| |||
428 | 451 |
| |
429 | 452 |
| |
430 | 453 |
| |
431 |
| - | |
| 454 | + | |
| 455 | + | |
432 | 456 |
| |
433 | 457 |
| |
| 458 | + | |
| 459 | + | |
434 | 460 |
| |
435 | 461 |
| |
436 | 462 |
| |
437 | 463 |
| |
438 | 464 |
| |
439 | 465 |
| |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
445 | 485 |
| |
446 |
| - | |
447 | 486 |
| |
448 | 487 |
| |
449 | 488 |
| |
| |||
466 | 505 |
| |
467 | 506 |
| |
468 | 507 |
| |
469 |
| - | |
| 508 | + | |
470 | 509 |
| |
471 | 510 |
| |
472 | 511 |
| |
| |||
505 | 544 |
| |
506 | 545 |
| |
507 | 546 |
| |
508 |
| - | |
509 |
| - | |
510 |
| - | |
511 |
| - | |
512 |
| - | |
513 |
| - | |
514 |
| - | |
515 |
| - | |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 | 547 |
| |
530 | 548 |
| |
531 | 549 |
| |
| |||
546 | 564 |
| |
547 | 565 |
| |
548 | 566 |
| |
| 567 | + | |
| 568 | + | |
| 569 | + | |
549 | 570 |
| |
550 | 571 |
| |
551 | 572 |
| |
| |||
564 | 585 |
| |
565 | 586 |
| |
566 | 587 |
| |
567 |
| - | |
568 |
| - | |
569 |
| - | |
570 |
| - | |
571 |
| - | |
572 |
| - | |
573 | 588 |
| |
574 | 589 |
| |
575 | 590 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| 36 | + | |
36 | 37 |
| |
37 | 38 |
| |
38 | 39 |
| |
|
0 commit comments
Comments
(0)