Re: [PATCH v2] sched/eevdf: Fix wakeup-preempt by checking cfs_rq->nr_running
From: Peter Zijlstra
Date: Mon Sep 30 2024 - 03:51:16 EST
On Wed, Sep 25, 2024 at 04:54:40PM +0800, Chen Yu wrote:
> Commit 85e511df3cec ("sched/eevdf: Allow shorter slices to wakeup-preempt")
> introduced a mechanism that a wakee with shorter slice could preempt
> the current running task. It also lower the bar for the current task
> to be preempted, by checking the rq->nr_running instead of cfs_rq->nr_running
> when the current task has ran out of time slice. But there is a scenario
> that is problematic. Say, if there is 1 cfs task and 1 rt task, before
> 85e511df3cec, update_deadline() will not trigger a reschedule, and after
> 85e511df3cec, since rq->nr_running is 2 and resched is true, a resched_curr()
> would happen.
>
So I'm applying the patch (that change was not indended), but I'm a
little confused by the above description. If we already have TIF_RESCHED
set, then doing resched_curr() should be a NO-OP.
At the same time, how can we have an RT task and not get TIF_RESCHED
set.