Re: [PATCH v4 4/5] sched/rt: Fix RT watchdog accounting for proxy execution

From: Peter Zijlstra

Date: Wed Sep 09 2026 - 07:15:41 EST


On Wed, Sep 09, 2026 at 06:29:00PM +0900, Hui Su wrote:

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 05e599665fdd..d8a785bec639 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6768,6 +6768,14 @@ static bool try_to_block_task(struct rq *rq, struct task_struct *p,
> return false;
> }
>
> + /*
> + * Proxy execution can keep a mutex-blocked task on the runqueue, so it
> + * may not pass through ENQUEUE_WAKEUP, which normally resets the RT
> + * watchdog interval.
> + */
> + if (sched_proxy_exec() && p->rt.timeout)
> + p->rt.timeout = 0;
> +
> p->is_blocked = 1;
>
> /*
> @@ -7243,6 +7251,16 @@ static void __sched notrace __schedule(int sched_mode)
> rq_set_donor(rq, next);
> }
>
> + /*
> + * End a previous RT proxy watchdog interval once neither context is
> + * in the RT class. Preserve the interval for an RT-policy task that is
> + * temporarily PI-boosted into the DL class.
> + */
> + if (sched_proxy_exec() && !task_has_rt_policy(next) &&
> + !rt_prio(next->prio) &&
> + !rt_prio(rq->donor->prio) && next->rt.timeout)
> + next->rt.timeout = 0;
> +
> picked:
> clear_tsk_need_resched(prev);
> clear_preempt_need_resched();

It might come as no surprise that this isn't going to fly. I've not
though about the problem yet, but we're not going to be sprinkling rt
bits like this in the middle of __schedule().