mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-04 11:12:02 +00:00
MINOR: listener: move thr_idx from the bind_conf to the listener
Tests show that it's slightly faster to have this field in the listener. The cache walk patterns are under heavy stress and having only this field written to in the bind_conf was wasting a cache line that was heavily read. Let's move this close to the other entries already written to in the listener. Warning, the position does have an impact on peak performance.
This commit is contained in:
parent
9f1d4e7f7f
commit
0cf33176bd
@ -170,7 +170,6 @@ struct bind_conf {
|
||||
struct list listeners; /* list of listeners using this bind config */
|
||||
unsigned long bind_proc; /* bitmask of processes allowed to use these listeners */
|
||||
unsigned long bind_thread; /* bitmask of threads allowed to use these listeners */
|
||||
unsigned int thr_idx; /* thread indexes for queue distribution : (t2<<16)+t1 */
|
||||
uint32_t ns_cip_magic; /* Excepted NetScaler Client IP magic number */
|
||||
struct list by_fe; /* next binding for the same frontend, or NULL */
|
||||
char *arg; /* argument passed to "bind" for better error reporting */
|
||||
@ -204,10 +203,10 @@ struct listener {
|
||||
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
|
||||
/* cache line boundary */
|
||||
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
|
||||
unsigned int thr_idx; /* thread indexes for queue distribution : (t2<<16)+t1 */
|
||||
unsigned int analysers; /* bitmap of required protocol analysers */
|
||||
int maxseg; /* for TCP, advertised MSS */
|
||||
int tcp_ut; /* for TCP, user timeout */
|
||||
/* 4 bytes hole */
|
||||
char *interface; /* interface name or NULL */
|
||||
char *name; /* listener's name */
|
||||
|
||||
@ -219,6 +218,7 @@ struct listener {
|
||||
unsigned int thr_conn[MAX_THREADS]; /* number of connections per thread */
|
||||
|
||||
/* cache line boundary */
|
||||
|
||||
struct list by_fe; /* chaining in frontend's list of listeners */
|
||||
struct list by_bind; /* chaining in bind_conf's list of listeners */
|
||||
struct bind_conf *bind_conf; /* "bind" line settings, include SSL settings among other things */
|
||||
|
@ -862,7 +862,7 @@ void listener_accept(int fd)
|
||||
/* keep a copy for the final update. thr_idx is composite
|
||||
* and made of (t2<<16) + t1.
|
||||
*/
|
||||
t0 = l->bind_conf->thr_idx;
|
||||
t0 = l->thr_idx;
|
||||
do {
|
||||
unsigned long m1, m2;
|
||||
int q1, q2;
|
||||
@ -937,7 +937,7 @@ void listener_accept(int fd)
|
||||
|
||||
/* new value for thr_idx */
|
||||
t1 += (t2 << 16);
|
||||
} while (unlikely(!HA_ATOMIC_CAS(&l->bind_conf->thr_idx, &t0, t1)));
|
||||
} while (unlikely(!HA_ATOMIC_CAS(&l->thr_idx, &t0, t1)));
|
||||
|
||||
/* We successfully selected the best thread "t" for this
|
||||
* connection. We use deferred accepts even if it's the
|
||||
|
Loading…
Reference in New Issue
Block a user