bind9/lib/isc
Ondřej Surý 6ffda5920e
Add the reader-writer synchronization with modified C-RW-WP
This changes the internal isc_rwlock implementation to:

  Irina Calciu, Dave Dice, Yossi Lev, Victor Luchangco, Virendra
  J. Marathe, and Nir Shavit.  2013.  NUMA-aware reader-writer locks.
  SIGPLAN Not. 48, 8 (August 2013), 157–166.
  DOI:https://doi.org/10.1145/2517327.24425

(The full article available from:
  http://mcg.cs.tau.ac.il/papers/ppopp2013-rwlocks.pdf)

The implementation is based on the The Writer-Preference Lock (C-RW-WP)
variant (see the 3.4 section of the paper for the rationale).

The implemented algorithm has been modified for simplicity and for usage
patterns in rbtdb.c.

The changes compared to the original algorithm:

  * We haven't implemented the cohort locks because that would require a
    knowledge of NUMA nodes, instead a simple atomic_bool is used as
    synchronization point for writer lock.

  * The per-thread reader counters are not being used - this would
    require the internal thread id (isc_tid_v) to be always initialized,
    even in the utilities; the change has a slight performance penalty,
    so we might revisit this change in the future.  However, this change
    also saves a lot of memory, because cache-line aligned counters were
    used, so on 32-core machine, the rwlock would be 4096+ bytes big.

  * The readers use a writer_barrier that will raise after a while when
    readers lock can't be acquired to prevent readers starvation.

  * Separate ingress and egress readers counters queues to reduce both
    inter and intra-thread contention.
2023-02-15 09:30:04 +01:00
..
include Add the reader-writer synchronization with modified C-RW-WP 2023-02-15 09:30:04 +01:00
netmgr Sync compile-time & run-time libuv requirements 2023-02-09 15:04:52 +01:00
.gitignore [master] update gitignore files; use rev-parse to get srcid 2014-06-17 13:49:30 -07:00
aes.c Remove EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() shims 2022-03-02 10:48:09 +00:00
ascii.c Consolidate some ASCII tables in isc/ascii and isc/hex 2022-09-12 12:18:57 +01:00
assertions.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
async.c isc_async_run() runs events in reverse order 2022-10-31 05:43:45 -07:00
backtrace.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
base32.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
base64.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
commandline.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
condition.c De-duplicate some calls to strerror_r() 2022-10-17 11:58:26 +01:00
counter.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
crc64.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dir.c remove some unused functions 2023-02-13 11:50:59 -08:00
entropy.c Switch the CSPRNG function from RAND_bytes() to uv_random() 2022-09-26 15:13:11 +02:00
errno.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
errno2result.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
errno2result.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
error.c Include the function name when reporting unexpected errors 2022-10-17 13:43:59 +01:00
event.c Simplify the isc_event API 2022-08-25 12:24:25 +02:00
file.c remove some unused functions 2023-02-13 11:50:59 -08:00
fsaccess.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
fsaccess_common.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
fsaccess_common_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
glob.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
hash.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
hashmap.c Add isc_hashmap_find() DbC check for valuep 2023-02-15 09:30:04 +01:00
heap.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
hex.c Consolidate some ASCII tables in isc/ascii and isc/hex 2022-09-12 12:18:57 +01:00
hmac.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ht.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
httpd.c Enable auto-reallocation for all isc_buffer_allocate() buffers 2022-12-20 19:13:48 +01:00
interfaceiter.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
iterated_hash.c Require C11 thread_local keyword and <threads.h> header 2023-02-08 21:33:23 +01:00
jemalloc_shim.h Fix ISC_MEM_ZERO on allocators with malloc_usable_size() 2023-02-06 11:21:12 +00:00
job.c New event loop handling API 2022-08-25 12:24:29 +02:00
job_p.h New event loop handling API 2022-08-25 12:24:29 +02:00
lex.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
lib.c remove isc_bind9 variable 2023-02-09 18:00:13 +00:00
log.c Add the reader-writer synchronization with modified C-RW-WP 2023-02-15 09:30:04 +01:00
loop.c Enhance the isc_loop unit to allow reference count tracking 2023-01-05 12:33:15 +00:00
loop_p.h Convert isc_ratelimiter API to use on-loop timers 2022-09-21 14:25:33 -07:00
Makefile.am Improve the spinloop pause / yield hint 2023-02-14 17:13:24 +00:00
managers.c Add the reader-writer synchronization with modified C-RW-WP 2023-02-15 09:30:04 +01:00
md.c Avoid implicit algorithm fetch for OpenSSL EVP_MD family 2023-01-18 18:32:57 +01:00
mem.c remove isc_bind9 variable 2023-02-09 18:00:13 +00:00
mem_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
meminfo.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
mutex.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
mutex_p.h Use library constructor to create default mutex attr once 2022-07-13 13:19:32 +02:00
mutexblock.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
net.c remove nonfunctional DSCP implementation 2023-01-09 12:15:21 -08:00
netaddr.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
netscope.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
nonce.c Switch the CSPRNG function from RAND_bytes() to uv_random() 2022-09-26 15:13:11 +02:00
openssl_shim.c Do not provide a shim for SSL_SESSION_is_resumable() 2022-05-23 18:25:18 +03:00
openssl_shim.h Do not provide a shim for SSL_SESSION_is_resumable() 2022-05-23 18:25:18 +03:00
os.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
os_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
parseint.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
picohttpparser.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
picohttpparser.h Add picohttpparser.{c.h} from https://github.com/h2o/picohttpparser 2022-10-14 11:26:54 +02:00
portset.c Use designated initializers instead of memset()/MEM_ZERO for structs 2022-10-05 16:44:05 +02:00
quota.c REQUIRE should not have side effects 2022-07-05 12:22:55 -07:00
radix.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
random.c Switch the CSPRNG function from RAND_bytes() to uv_random() 2022-09-26 15:13:11 +02:00
random_p.h Move random number re-seeding out of the hot path 2022-09-19 16:27:12 +02:00
ratelimiter.c refactor isc_ratelimiter to use loop callbacks 2023-01-31 21:41:19 -08:00
regex.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
region.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
result.c Refactor isc_nm_xfr_allowed() 2023-01-19 10:24:08 +00:00
rwlock.c Add the reader-writer synchronization with modified C-RW-WP 2023-02-15 09:30:04 +01:00
safe.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
serial.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
signal.c New event loop handling API 2022-08-25 12:24:29 +02:00
siphash.c Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24 2023-01-10 17:52:56 +11:00
sockaddr.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
stats.c Assert if statistics counter underflows in the developer mode 2022-02-10 17:18:09 +01:00
stdio.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
stdtime.c Deduplicate time unit conversion factors 2022-11-25 13:23:36 +00:00
string.c Use strnstr implementation from FreeBSD if not provided by OS 2022-10-04 14:21:41 +11:00
symtab.c Consolidate some ASCII tables in isc/ascii and isc/hex 2022-09-12 12:18:57 +01:00
syslog.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
task.c Refactor dnssec-signzone to use loop callbacks 2023-01-21 23:39:09 -08:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
thread.c Fix error reporting for POSIX Threads functions 2022-09-09 20:25:47 +02:00
tid.c Require C11 thread_local keyword and <threads.h> header 2023-02-08 21:33:23 +01:00
time.c Add isc_time_monotonic() 2023-02-06 12:14:51 +00:00
timer.c Require isc_timer to be manipulated on the timer loop 2022-09-21 14:25:33 -07:00
tls.c Add the reader-writer synchronization with modified C-RW-WP 2023-02-15 09:30:04 +01:00
tm.c Consolidate some ASCII tables in isc/ascii and isc/hex 2022-09-12 12:18:57 +01:00
trampoline.c Use thread_local EVP_MD_CTX in isc_iterated_hash() 2023-01-18 19:36:21 +01:00
trampoline_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
url.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
utf8.c Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
uv.c Add and use semantic patch to replace isc_mem_get/allocate+memset 2022-10-05 16:44:05 +02:00
work.c New event loop handling API 2022-08-25 12:24:29 +02:00
xml.c Add autoconf option to enable memory leak detection in libraries 2022-09-27 17:53:04 +02:00