mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-16 00:14:31 +00:00
MINOR: sched: split tasklet_wakeup() into tasklet_wakeup_on()
tasklet_wakeup() only checks tl->tid to know whether the task is programmed to run on the current thread or on a specific thread. We'll have to ease this selection in a subsequent patch, preferably without modifying tl->tid, so let's have a new tasklet_wakeup_on() function to specify the thread number to run on. That the logic has not changed at all.
This commit is contained in:
parent
18ed789ae2
commit
43079e0731
@ -322,9 +322,12 @@ static inline struct task *task_unlink_rq(struct task *t)
|
||||
return t;
|
||||
}
|
||||
|
||||
static inline void tasklet_wakeup(struct tasklet *tl)
|
||||
/* schedules tasklet <tl> to run onto thread <thr> or the current thread if
|
||||
* <thr> is negative.
|
||||
*/
|
||||
static inline void tasklet_wakeup_on(struct tasklet *tl, int thr)
|
||||
{
|
||||
if (likely(tl->tid < 0)) {
|
||||
if (likely(thr < 0)) {
|
||||
/* this tasklet runs on the caller thread */
|
||||
if (LIST_ISEMPTY(&tl->list)) {
|
||||
if (tl->state & TASK_SELF_WAKING) {
|
||||
@ -349,15 +352,22 @@ static inline void tasklet_wakeup(struct tasklet *tl)
|
||||
}
|
||||
} else {
|
||||
/* this tasklet runs on a specific thread */
|
||||
if (MT_LIST_ADDQ(&task_per_thread[tl->tid].shared_tasklet_list, (struct mt_list *)&tl->list) == 1) {
|
||||
if (MT_LIST_ADDQ(&task_per_thread[thr].shared_tasklet_list, (struct mt_list *)&tl->list) == 1) {
|
||||
_HA_ATOMIC_ADD(&tasks_run_queue, 1);
|
||||
if (sleeping_thread_mask & (1UL << tl->tid)) {
|
||||
_HA_ATOMIC_AND(&sleeping_thread_mask, ~(1UL << tl->tid));
|
||||
wake_thread(tl->tid);
|
||||
if (sleeping_thread_mask & (1UL << thr)) {
|
||||
_HA_ATOMIC_AND(&sleeping_thread_mask, ~(1UL << thr));
|
||||
wake_thread(thr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* schedules tasklet <tl> to run onto the thread designated by tl->tid, which
|
||||
* is either its owner thread if >= 0 or the current thread if < 0.
|
||||
*/
|
||||
static inline void tasklet_wakeup(struct tasklet *tl)
|
||||
{
|
||||
tasklet_wakeup_on(tl, tl->tid);
|
||||
}
|
||||
|
||||
/* Insert a tasklet into the tasklet list. If used with a plain task instead,
|
||||
|
Loading…
Reference in New Issue
Block a user