mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-16 23:21:01 +01:00
MINOR: sched: pass the thread number to is_sched_alive()
Now it will be possible to query any thread's scheduler state, not only the current one. This aims at simplifying the watchdog checks for reported threads. The operation is now a simple atomic xchg.
This commit is contained in:
parent
7c7e17a605
commit
25f5f357cc
@ -123,11 +123,11 @@ void wake_expired_tasks(void);
|
|||||||
*/
|
*/
|
||||||
int next_timer_expiry(void);
|
int next_timer_expiry(void);
|
||||||
|
|
||||||
/* Pings the scheduler to verify that tasks continue running.
|
/* Pings the scheduler to verify that tasks continue running for thread <thr>.
|
||||||
* Returns 1 if the scheduler made progress since last call,
|
* Returns 1 if the scheduler made progress since last call, 0 if it looks
|
||||||
* 0 if it looks stuck.
|
* stuck. It marks it as stuck for next visit.
|
||||||
*/
|
*/
|
||||||
int is_sched_alive(void);
|
int is_sched_alive(int thr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete every tasks before running the master polling loop
|
* Delete every tasks before running the master polling loop
|
||||||
|
|||||||
15
src/task.c
15
src/task.c
@ -910,18 +910,13 @@ void process_runnable_tasks()
|
|||||||
activity[tid].long_rq++;
|
activity[tid].long_rq++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pings the scheduler to verify that tasks continue running.
|
/* Pings the scheduler to verify that tasks continue running for thread <thr>.
|
||||||
* Returns 1 if the scheduler made progress since last call,
|
* Returns 1 if the scheduler made progress since last call, 0 if it looks
|
||||||
* 0 if it looks stuck.
|
* stuck. It marks it as stuck for next visit.
|
||||||
*/
|
*/
|
||||||
int is_sched_alive(void)
|
int is_sched_alive(int thr)
|
||||||
{
|
{
|
||||||
if (sched_ctx[tid].sched_stuck)
|
return !HA_ATOMIC_XCHG(&sched_ctx[thr].sched_stuck, 1);
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* next time we'll know if any progress was made */
|
|
||||||
sched_ctx[tid].sched_stuck = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -189,7 +189,7 @@ void wdt_handler(int sig, siginfo_t *si, void *arg)
|
|||||||
if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_STUCK)
|
if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_STUCK)
|
||||||
ha_panic();
|
ha_panic();
|
||||||
|
|
||||||
if (!is_sched_alive())
|
if (!is_sched_alive(thr))
|
||||||
ha_stuck_warning();
|
ha_stuck_warning();
|
||||||
|
|
||||||
/* let's go on */
|
/* let's go on */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user