diff --git a/addons/ot/src/opentracing.c b/addons/ot/src/opentracing.c index b79b90a51..58936d122 100644 --- a/addons/ot/src/opentracing.c +++ b/addons/ot/src/opentracing.c @@ -20,7 +20,7 @@ #include "include.h" -static struct pool_head *pool_head_ot_span_context = NULL; +static struct pool_head *pool_head_ot_span_context __read_mostly = NULL; #ifdef USE_POOL_OT_SPAN_CONTEXT REGISTER_POOL(&pool_head_ot_span_context, "ot_span_context", MAX(sizeof(struct otc_span), sizeof(struct otc_span_context))); diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c index 462c86577..ace8a229e 100644 --- a/addons/ot/src/scope.c +++ b/addons/ot/src/scope.c @@ -20,9 +20,9 @@ #include "include.h" -static struct pool_head *pool_head_ot_scope_span = NULL; -static struct pool_head *pool_head_ot_scope_context = NULL; -static struct pool_head *pool_head_ot_runtime_context = NULL; +static struct pool_head *pool_head_ot_scope_span __read_mostly = NULL; +static struct pool_head *pool_head_ot_scope_context __read_mostly = NULL; +static struct pool_head *pool_head_ot_runtime_context __read_mostly = NULL; #ifdef USE_POOL_OT_SCOPE_SPAN REGISTER_POOL(&pool_head_ot_scope_span, "ot_scope_span", sizeof(struct flt_ot_scope_span)); diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index c94860e44..e0e03fc32 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -37,12 +37,12 @@ /* This macro declares a pool head and registers its creation */ #define DECLARE_POOL(ptr, name, size) \ - struct pool_head *(ptr) = NULL; \ + struct pool_head *(ptr) __read_mostly = NULL; \ REGISTER_POOL(&ptr, name, size) /* This macro declares a static pool head and registers its creation */ #define DECLARE_STATIC_POOL(ptr, name, size) \ - static struct pool_head *(ptr); \ + static struct pool_head *(ptr) __read_mostly; \ REGISTER_POOL(&ptr, name, size) /* poison each newly allocated area with this byte if >= 0 */ diff --git a/src/chunk.c b/src/chunk.c index ade0323a8..5c720c1bc 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -26,12 +26,12 @@ static THREAD_LOCAL struct buffer trash_chunk1; static THREAD_LOCAL struct buffer trash_chunk2; /* trash buffers used for various conversions */ -static int trash_size; +static int trash_size __read_mostly; static THREAD_LOCAL char *trash_buf1; static THREAD_LOCAL char *trash_buf2; /* the trash pool for reentrant allocations */ -struct pool_head *pool_head_trash = NULL; +struct pool_head *pool_head_trash __read_mostly = NULL; /* this is used to drain data, and as a temporary buffer for sprintf()... */ THREAD_LOCAL struct buffer trash = { }; diff --git a/src/compression.c b/src/compression.c index da6213ed3..1d275edac 100644 --- a/src/compression.c +++ b/src/compression.c @@ -48,11 +48,11 @@ static void *alloc_zlib(void *opaque, unsigned int items, unsigned int size); static void free_zlib(void *opaque, void *ptr); /* zlib allocation */ -static struct pool_head *zlib_pool_deflate_state = NULL; -static struct pool_head *zlib_pool_window = NULL; -static struct pool_head *zlib_pool_prev = NULL; -static struct pool_head *zlib_pool_head = NULL; -static struct pool_head *zlib_pool_pending_buf = NULL; +static struct pool_head *zlib_pool_deflate_state __read_mostly = NULL; +static struct pool_head *zlib_pool_window __read_mostly = NULL; +static struct pool_head *zlib_pool_prev __read_mostly = NULL; +static struct pool_head *zlib_pool_head __read_mostly = NULL; +static struct pool_head *zlib_pool_pending_buf __read_mostly = NULL; long zlib_used_memory = 0; diff --git a/src/dynbuf.c b/src/dynbuf.c index 8b492e29d..fcbb8faa4 100644 --- a/src/dynbuf.c +++ b/src/dynbuf.c @@ -20,7 +20,7 @@ #include #include -struct pool_head *pool_head_buffer; +struct pool_head *pool_head_buffer __read_mostly; /* perform minimal intializations, report 0 in case of error, 1 if OK. */ int init_buffer() diff --git a/src/extcheck.c b/src/extcheck.c index 79a63b2a6..808b4bb71 100644 --- a/src/extcheck.c +++ b/src/extcheck.c @@ -43,7 +43,7 @@ static struct list pid_list = LIST_HEAD_INIT(pid_list); -static struct pool_head *pool_head_pid_list; +static struct pool_head *pool_head_pid_list __read_mostly; __decl_spinlock(pid_list_lock); struct extcheck_env { diff --git a/src/hpack-tbl.c b/src/hpack-tbl.c index da81d296b..8df10319a 100644 --- a/src/hpack-tbl.c +++ b/src/hpack-tbl.c @@ -99,7 +99,7 @@ const struct http_hdr hpack_sht[HPACK_SHT_SIZE] = { [61] = { .n = IST("www-authenticate"), .v = IST("") }, }; -struct pool_head *pool_head_hpack_tbl = NULL; +struct pool_head *pool_head_hpack_tbl __read_mostly = NULL; #ifdef DEBUG_HPACK /* dump the whole dynamic header table */ diff --git a/src/http_ana.c b/src/http_ana.c index f49d07f32..0a32107fa 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -42,8 +42,8 @@ extern const char *stat_status_codes[]; -struct pool_head *pool_head_requri = NULL; -struct pool_head *pool_head_capture = NULL; +struct pool_head *pool_head_requri __read_mostly = NULL; +struct pool_head *pool_head_capture __read_mostly = NULL; static void http_end_request(struct stream *s); diff --git a/src/ssl_sock.c b/src/ssl_sock.c index f1b0668ab..d3e593182 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -482,14 +482,14 @@ static STACK_OF(X509_NAME)* ssl_get_client_ca_file(char *path) return ca_e->ca_list; } -struct pool_head *pool_head_ssl_capture = NULL; +struct pool_head *pool_head_ssl_capture __read_mostly = NULL; int ssl_capture_ptr_index = -1; int ssl_app_data_index = -1; #ifdef HAVE_OPENSSL_KEYLOG int ssl_keylog_index = -1; -struct pool_head *pool_head_ssl_keylog = NULL; -struct pool_head *pool_head_ssl_keylog_str = NULL; +struct pool_head *pool_head_ssl_keylog __read_mostly = NULL; +struct pool_head *pool_head_ssl_keylog_str __read_mostly = NULL; #endif #if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0)