From: Willy Tarreau Date: Wed, 24 Jun 2026 13:50:47 +0000 (+0200) Subject: MINOR: task: make tasklet_wakeup() explicitly call _tasklet_wakeup_here() X-Git-Tag: v3.5-dev1~13 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw//%22%22?a=commitdiff_plain;h=721e9321156fca104deba0581b8cd70c5ac427eb;p=haproxy.git MINOR: task: make tasklet_wakeup() explicitly call _tasklet_wakeup_here() This patch moves the tid check upper in the chain, in tasklet_wakeup() so as to branch to _tasklet_wakeup_here() for run-anywhere tasklets, or _tasklet_wakeup_on() for designated threads. The tid is retrieved via __task_get_current_owner() so that the call remains compatible with tasklets that would have a super-negative tid due to being tasks used as tasklets. --- diff --git a/include/haproxy/task.h b/include/haproxy/task.h index 203abb882..aa8718f14 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -521,8 +521,15 @@ static inline void _tasklet_wakeup_on(struct tasklet *tl, int thr, uint f, const * wakeup cause to the tasklet. When not set, the arg defaults to zero (i.e. no * flag is added). */ -#define tasklet_wakeup(tl, ...) \ - _tasklet_wakeup_on(tl, (tl)->tid, DEFVAL(TASK_WOKEN_OTHER, ##__VA_ARGS__), MK_CALLER(WAKEUP_TYPE_TASKLET_WAKEUP, 0, 0)) +#define tasklet_wakeup(tl, ...) do { \ + const struct ha_caller *_caller = MK_CALLER(WAKEUP_TYPE_TASKLET_WAKEUP, 0, 0); \ + uint _flg = DEFVAL(TASK_WOKEN_OTHER, ##__VA_ARGS__); \ + int _tl_tid = __task_get_current_owner((tl)->tid); \ + if (_tl_tid < 0) \ + _tasklet_wakeup_here(tl, _flg, _caller); \ + else \ + _tasklet_wakeup_on(tl, _tl_tid, _flg, _caller); \ + } while (0) /* instantly wakes up task on its owner thread even if it's not the current * one, bypassing the run queue. The purpose is to be able to avoid contention