Re: [PATCH 1/7] sched: warn for high latency with TIF_NEED_RESCHED_LAZY
From: Sebastian Andrzej Siewior
Date: Thu Oct 10 2024 - 02:38:53 EST
On 2024-10-09 09:54:05 [-0700], Ankur Arora wrote:
> resched_latency_warn() now also warns if TIF_NEED_RESCHED_LAZY is set
> without rescheduling for more than the latency_warn_ms period.
The description is odd. I think you want to say that
resched_latency_warn() does not warn if a task has TIF_NEED_RESCHED_LAZY
has set for longer periods and you want to add this functionality.
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Peter Ziljstra <peterz@xxxxxxxxxxxxx>
> Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
> Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
> Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx>
…
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 694bfcf153cb..1229766b704e 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5571,7 +5571,7 @@ static u64 cpu_resched_latency(struct rq *rq)
> if (sysctl_resched_latency_warn_once && warned_once)
> return 0;
>
> - if (!need_resched() || !latency_warn_ms)
> + if ((!need_resched() && !tif_need_resched_lazy()) || !latency_warn_ms)
tif_need_resched_lazy() is not doing what you think it is doing.
Either PeterZ makes a helper for this or you need
tif_test_bit(TIF_NEED_RESCHED_LAZY).
> return 0;
>
> if (system_state == SYSTEM_BOOTING)
Sebastian