CLEANUP: tasks: rename task_remove_from_tasklet_list() to tasklet_remove_*
The function really only operates on tasklets, its arguments are always tasklets cast as tasks to match the function's type, to be cast back to a struct tasklet. Let's rename it to tasklet_remove_from_tasklet_list(), take a struct tasklet, and get rid of the undesired task casts.
This commit is contained in:
parent
3c39a7d889
commit
86eded6c69
@ -246,21 +246,19 @@ static inline void task_insert_into_tasklet_list(struct task *t)
|
|||||||
LIST_ADDQ(&task_per_thread[tid].task_list, &tl->list);
|
LIST_ADDQ(&task_per_thread[tid].task_list, &tl->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove the task from the tasklet list. The task MUST already be there. If
|
/* remove the task from the tasklet list. The tasklet MUST already be there. If
|
||||||
* unsure, use task_remove_from_task_list() instead.
|
* unsure, use tasklet_remove_from_tasklet_list() instead.
|
||||||
*/
|
*/
|
||||||
static inline void __task_remove_from_tasklet_list(struct task *t)
|
static inline void __tasklet_remove_from_tasklet_list(struct tasklet *t)
|
||||||
{
|
{
|
||||||
LIST_DEL_INIT(&((struct tasklet *)t)->list);
|
LIST_DEL_INIT(&t->list);
|
||||||
if (!TASK_IS_TASKLET(t))
|
|
||||||
task_per_thread[tid].task_list_size--;
|
|
||||||
_HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
_HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void task_remove_from_tasklet_list(struct task *t)
|
static inline void tasklet_remove_from_tasklet_list(struct tasklet *t)
|
||||||
{
|
{
|
||||||
if (likely(!LIST_ISEMPTY(&((struct tasklet *)t)->list)))
|
if (likely(!LIST_ISEMPTY(&t->list)))
|
||||||
__task_remove_from_tasklet_list(t);
|
__tasklet_remove_from_tasklet_list(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
22
src/checks.c
22
src/checks.c
@ -2254,7 +2254,7 @@ static struct task *process_chk_conn(struct task *t, void *context, unsigned sho
|
|||||||
* I/O handler expects to have a cs, so remove
|
* I/O handler expects to have a cs, so remove
|
||||||
* the tasklet
|
* the tasklet
|
||||||
*/
|
*/
|
||||||
task_remove_from_tasklet_list((struct task *)check->wait_list.tasklet);
|
tasklet_remove_from_tasklet_list(check->wait_list.tasklet);
|
||||||
cs_destroy(cs);
|
cs_destroy(cs);
|
||||||
cs = check->cs = NULL;
|
cs = check->cs = NULL;
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
@ -2315,10 +2315,10 @@ static struct task *process_chk_conn(struct task *t, void *context, unsigned sho
|
|||||||
check->wait_list.events,
|
check->wait_list.events,
|
||||||
&check->wait_list);
|
&check->wait_list);
|
||||||
/* We may have been scheduled to run, and the
|
/* We may have been scheduled to run, and the
|
||||||
* I/O handler expects to have a cs, so remove
|
* I/O handler expects to have a cs, so remove
|
||||||
* the tasklet
|
* the tasklet
|
||||||
*/
|
*/
|
||||||
task_remove_from_tasklet_list((struct task *)check->wait_list.tasklet);
|
tasklet_remove_from_tasklet_list(check->wait_list.tasklet);
|
||||||
cs_destroy(cs);
|
cs_destroy(cs);
|
||||||
cs = check->cs = NULL;
|
cs = check->cs = NULL;
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
@ -2831,13 +2831,11 @@ static int tcpcheck_main(struct check *check)
|
|||||||
cs->conn->xprt_ctx,
|
cs->conn->xprt_ctx,
|
||||||
check->wait_list.events,
|
check->wait_list.events,
|
||||||
&check->wait_list);
|
&check->wait_list);
|
||||||
/* We may have been scheduled to run, and the
|
/* We may have been scheduled to run, and the
|
||||||
* I/O handler expects to have a cs, so remove
|
* I/O handler expects to have a cs, so remove
|
||||||
* the tasklet
|
* the tasklet
|
||||||
*/
|
*/
|
||||||
task_remove_from_tasklet_list((struct task *)check->wait_list.tasklet);
|
tasklet_remove_from_tasklet_list(check->wait_list.tasklet);
|
||||||
|
|
||||||
|
|
||||||
cs_destroy(check->cs);
|
cs_destroy(check->cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,7 +911,7 @@ static void h2s_destroy(struct h2s *h2s)
|
|||||||
*/
|
*/
|
||||||
LIST_DEL_INIT(&h2s->list);
|
LIST_DEL_INIT(&h2s->list);
|
||||||
if (LIST_ADDED(&h2s->sending_list)) {
|
if (LIST_ADDED(&h2s->sending_list)) {
|
||||||
task_remove_from_tasklet_list((struct task *)h2s->send_wait->tasklet);
|
tasklet_remove_from_tasklet_list(h2s->send_wait->tasklet);
|
||||||
LIST_DEL_INIT(&h2s->sending_list);
|
LIST_DEL_INIT(&h2s->sending_list);
|
||||||
}
|
}
|
||||||
tasklet_free(h2s->wait_event.tasklet);
|
tasklet_free(h2s->wait_event.tasklet);
|
||||||
@ -3144,7 +3144,7 @@ static void h2_detach(struct conn_stream *cs)
|
|||||||
/* The stream is about to die, so no need to attempt to run its task */
|
/* The stream is about to die, so no need to attempt to run its task */
|
||||||
if (LIST_ADDED(&h2s->sending_list) &&
|
if (LIST_ADDED(&h2s->sending_list) &&
|
||||||
h2s->send_wait != &h2s->wait_event) {
|
h2s->send_wait != &h2s->wait_event) {
|
||||||
task_remove_from_tasklet_list((struct task *)h2s->send_wait->tasklet);
|
tasklet_remove_from_tasklet_list(h2s->send_wait->tasklet);
|
||||||
LIST_DEL_INIT(&h2s->sending_list);
|
LIST_DEL_INIT(&h2s->sending_list);
|
||||||
/*
|
/*
|
||||||
* At this point, the stream_interface is supposed to have called
|
* At this point, the stream_interface is supposed to have called
|
||||||
@ -5346,7 +5346,7 @@ static int h2_unsubscribe(struct conn_stream *cs, int event_type, void *param)
|
|||||||
/* We were about to send, make sure it does not happen */
|
/* We were about to send, make sure it does not happen */
|
||||||
if (LIST_ADDED(&h2s->sending_list) &&
|
if (LIST_ADDED(&h2s->sending_list) &&
|
||||||
h2s->send_wait != &h2s->wait_event) {
|
h2s->send_wait != &h2s->wait_event) {
|
||||||
task_remove_from_tasklet_list((struct task *)h2s->send_wait->tasklet);
|
tasklet_remove_from_tasklet_list(h2s->send_wait->tasklet);
|
||||||
LIST_DEL_INIT(&h2s->sending_list);
|
LIST_DEL_INIT(&h2s->sending_list);
|
||||||
}
|
}
|
||||||
h2s->send_wait = NULL;
|
h2s->send_wait = NULL;
|
||||||
@ -5439,7 +5439,7 @@ static void h2_stop_senders(struct h2c *h2c)
|
|||||||
|
|
||||||
list_for_each_entry_safe(h2s, h2s_back, &h2c->sending_list, sending_list) {
|
list_for_each_entry_safe(h2s, h2s_back, &h2c->sending_list, sending_list) {
|
||||||
LIST_DEL_INIT(&h2s->sending_list);
|
LIST_DEL_INIT(&h2s->sending_list);
|
||||||
task_remove_from_tasklet_list((struct task *)h2s->send_wait->tasklet);
|
tasklet_remove_from_tasklet_list(h2s->send_wait->tasklet);
|
||||||
h2s->send_wait->events |= SUB_RETRY_SEND;
|
h2s->send_wait->events |= SUB_RETRY_SEND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ void process_runnable_tasks()
|
|||||||
t = (struct task *)LIST_ELEM(task_per_thread[tid].task_list.n, struct tasklet *, list);
|
t = (struct task *)LIST_ELEM(task_per_thread[tid].task_list.n, struct tasklet *, list);
|
||||||
state = _HA_ATOMIC_XCHG(&t->state, TASK_RUNNING);
|
state = _HA_ATOMIC_XCHG(&t->state, TASK_RUNNING);
|
||||||
__ha_barrier_atomic_store();
|
__ha_barrier_atomic_store();
|
||||||
__task_remove_from_tasklet_list(t);
|
__tasklet_remove_from_tasklet_list((struct tasklet *)t);
|
||||||
|
|
||||||
ti->flags &= ~TI_FL_STUCK; // this thread is still running
|
ti->flags &= ~TI_FL_STUCK; // this thread is still running
|
||||||
activity[tid].ctxsw++;
|
activity[tid].ctxsw++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user