MINOR: connection: use MT_LIST_ADDQ() to add connections to idle lists
When a connection is added to an idle list, it's already detached and cannot be seen by two threads at once, so there's no point using TRY_ADDQ, there will never be any conflict. Let's just use the cheaper ADDQ.
This commit is contained in:
parent
8689127816
commit
a9d7b76f6a
|
@ -273,11 +273,11 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
|
|||
conn->idle_time = now_ms;
|
||||
if (is_safe) {
|
||||
conn->flags = (conn->flags & ~CO_FL_LIST_MASK) | CO_FL_SAFE_LIST;
|
||||
MT_LIST_TRY_ADDQ(&srv->safe_conns[tid], (struct mt_list *)&conn->list);
|
||||
MT_LIST_ADDQ(&srv->safe_conns[tid], (struct mt_list *)&conn->list);
|
||||
_HA_ATOMIC_ADD(&srv->curr_safe_nb, 1);
|
||||
} else {
|
||||
conn->flags = (conn->flags & ~CO_FL_LIST_MASK) | CO_FL_IDLE_LIST;
|
||||
MT_LIST_TRY_ADDQ(&srv->idle_conns[tid], (struct mt_list *)&conn->list);
|
||||
MT_LIST_ADDQ(&srv->idle_conns[tid], (struct mt_list *)&conn->list);
|
||||
_HA_ATOMIC_ADD(&srv->curr_idle_nb, 1);
|
||||
}
|
||||
_HA_ATOMIC_ADD(&srv->curr_idle_thr[tid], 1);
|
||||
|
|
|
@ -1345,7 +1345,7 @@ int connect_server(struct stream *s)
|
|||
if (tokill_conn) {
|
||||
/* We got one, put it into the concerned thread's to kill list, and wake it's kill task */
|
||||
|
||||
MT_LIST_TRY_ADDQ(&idle_conns[i].toremove_conns,
|
||||
MT_LIST_ADDQ(&idle_conns[i].toremove_conns,
|
||||
(struct mt_list *)&tokill_conn->list);
|
||||
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
|
||||
|
|
|
@ -2956,9 +2956,9 @@ static struct task *fcgi_io_cb(struct task *t, void *ctx, unsigned short status)
|
|||
struct server *srv = objt_server(conn->target);
|
||||
|
||||
if (conn_in_list == CO_FL_SAFE_LIST)
|
||||
MT_LIST_TRY_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
else
|
||||
MT_LIST_TRY_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -2265,9 +2265,9 @@ static struct task *h1_io_cb(struct task *t, void *ctx, unsigned short status)
|
|||
struct server *srv = objt_server(conn->target);
|
||||
|
||||
if (conn_in_list == CO_FL_SAFE_LIST)
|
||||
MT_LIST_TRY_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
else
|
||||
MT_LIST_TRY_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -3565,9 +3565,9 @@ static struct task *h2_io_cb(struct task *t, void *ctx, unsigned short status)
|
|||
struct server *srv = objt_server(conn->target);
|
||||
|
||||
if (conn_in_list == CO_FL_SAFE_LIST)
|
||||
MT_LIST_TRY_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
else
|
||||
MT_LIST_TRY_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
}
|
||||
|
||||
leave:
|
||||
|
|
|
@ -5676,9 +5676,9 @@ static struct task *ssl_sock_io_cb(struct task *t, void *context, unsigned short
|
|||
struct server *srv = objt_server(conn->target);
|
||||
|
||||
if (conn_in_list == CO_FL_SAFE_LIST)
|
||||
MT_LIST_TRY_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->safe_conns[tid], &conn->list);
|
||||
else
|
||||
MT_LIST_TRY_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
MT_LIST_ADDQ(&srv->idle_conns[tid], &conn->list);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue