MINOR: pool: move pool declarations to read_mostly

All pool heads are accessed via a pointer and should not be shared with
highly written variables. Move them to the read_mostly section.
This commit is contained in:
Willy Tarreau 2021-04-10 17:23:00 +02:00
parent 8209c9aa18
commit ff88270ef9
10 changed files with 21 additions and 21 deletions

View File

@ -20,7 +20,7 @@
#include "include.h" #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 #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))); REGISTER_POOL(&pool_head_ot_span_context, "ot_span_context", MAX(sizeof(struct otc_span), sizeof(struct otc_span_context)));

View File

@ -20,9 +20,9 @@
#include "include.h" #include "include.h"
static struct pool_head *pool_head_ot_scope_span = NULL; static struct pool_head *pool_head_ot_scope_span __read_mostly = NULL;
static struct pool_head *pool_head_ot_scope_context = NULL; static struct pool_head *pool_head_ot_scope_context __read_mostly = NULL;
static struct pool_head *pool_head_ot_runtime_context = NULL; static struct pool_head *pool_head_ot_runtime_context __read_mostly = NULL;
#ifdef USE_POOL_OT_SCOPE_SPAN #ifdef USE_POOL_OT_SCOPE_SPAN
REGISTER_POOL(&pool_head_ot_scope_span, "ot_scope_span", sizeof(struct flt_ot_scope_span)); REGISTER_POOL(&pool_head_ot_scope_span, "ot_scope_span", sizeof(struct flt_ot_scope_span));

View File

@ -37,12 +37,12 @@
/* This macro declares a pool head <ptr> and registers its creation */ /* This macro declares a pool head <ptr> and registers its creation */
#define DECLARE_POOL(ptr, name, size) \ #define DECLARE_POOL(ptr, name, size) \
struct pool_head *(ptr) = NULL; \ struct pool_head *(ptr) __read_mostly = NULL; \
REGISTER_POOL(&ptr, name, size) REGISTER_POOL(&ptr, name, size)
/* This macro declares a static pool head <ptr> and registers its creation */ /* This macro declares a static pool head <ptr> and registers its creation */
#define DECLARE_STATIC_POOL(ptr, name, size) \ #define DECLARE_STATIC_POOL(ptr, name, size) \
static struct pool_head *(ptr); \ static struct pool_head *(ptr) __read_mostly; \
REGISTER_POOL(&ptr, name, size) REGISTER_POOL(&ptr, name, size)
/* poison each newly allocated area with this byte if >= 0 */ /* poison each newly allocated area with this byte if >= 0 */

View File

@ -26,12 +26,12 @@ static THREAD_LOCAL struct buffer trash_chunk1;
static THREAD_LOCAL struct buffer trash_chunk2; static THREAD_LOCAL struct buffer trash_chunk2;
/* trash buffers used for various conversions */ /* 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_buf1;
static THREAD_LOCAL char *trash_buf2; static THREAD_LOCAL char *trash_buf2;
/* the trash pool for reentrant allocations */ /* 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()... */ /* this is used to drain data, and as a temporary buffer for sprintf()... */
THREAD_LOCAL struct buffer trash = { }; THREAD_LOCAL struct buffer trash = { };

View File

@ -48,11 +48,11 @@ static void *alloc_zlib(void *opaque, unsigned int items, unsigned int size);
static void free_zlib(void *opaque, void *ptr); static void free_zlib(void *opaque, void *ptr);
/* zlib allocation */ /* zlib allocation */
static struct pool_head *zlib_pool_deflate_state = NULL; static struct pool_head *zlib_pool_deflate_state __read_mostly = NULL;
static struct pool_head *zlib_pool_window = NULL; static struct pool_head *zlib_pool_window __read_mostly = NULL;
static struct pool_head *zlib_pool_prev = NULL; static struct pool_head *zlib_pool_prev __read_mostly = NULL;
static struct pool_head *zlib_pool_head = NULL; static struct pool_head *zlib_pool_head __read_mostly = NULL;
static struct pool_head *zlib_pool_pending_buf = NULL; static struct pool_head *zlib_pool_pending_buf __read_mostly = NULL;
long zlib_used_memory = 0; long zlib_used_memory = 0;

View File

@ -20,7 +20,7 @@
#include <haproxy/list.h> #include <haproxy/list.h>
#include <haproxy/pool.h> #include <haproxy/pool.h>
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. */ /* perform minimal intializations, report 0 in case of error, 1 if OK. */
int init_buffer() int init_buffer()

View File

@ -43,7 +43,7 @@
static struct list pid_list = LIST_HEAD_INIT(pid_list); 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); __decl_spinlock(pid_list_lock);
struct extcheck_env { struct extcheck_env {

View File

@ -99,7 +99,7 @@ const struct http_hdr hpack_sht[HPACK_SHT_SIZE] = {
[61] = { .n = IST("www-authenticate"), .v = IST("") }, [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 #ifdef DEBUG_HPACK
/* dump the whole dynamic header table */ /* dump the whole dynamic header table */

View File

@ -42,8 +42,8 @@
extern const char *stat_status_codes[]; extern const char *stat_status_codes[];
struct pool_head *pool_head_requri = NULL; struct pool_head *pool_head_requri __read_mostly = NULL;
struct pool_head *pool_head_capture = NULL; struct pool_head *pool_head_capture __read_mostly = NULL;
static void http_end_request(struct stream *s); static void http_end_request(struct stream *s);

View File

@ -482,14 +482,14 @@ static STACK_OF(X509_NAME)* ssl_get_client_ca_file(char *path)
return ca_e->ca_list; 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_capture_ptr_index = -1;
int ssl_app_data_index = -1; int ssl_app_data_index = -1;
#ifdef HAVE_OPENSSL_KEYLOG #ifdef HAVE_OPENSSL_KEYLOG
int ssl_keylog_index = -1; int ssl_keylog_index = -1;
struct pool_head *pool_head_ssl_keylog = NULL; struct pool_head *pool_head_ssl_keylog __read_mostly = NULL;
struct pool_head *pool_head_ssl_keylog_str = NULL; struct pool_head *pool_head_ssl_keylog_str __read_mostly = NULL;
#endif #endif
#if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0) #if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0)