Re: [PATCH] sched/fair: Prevent cfs_rq from being unthrottled with zero runtime_remaining
From: Aaron Lu
Date: Tue Sep 30 2025 - 03:56:21 EST
On Mon, Sep 29, 2025 at 03:04:03PM +0530, K Prateek Nayak wrote:
... ...
> Can we instead do a check_enqueue_throttle() in enqueue_throttled_task()
> if we find cfs_rq->throttled_limbo_list to be empty?
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 18a30ae35441..fd2d4dad9c27 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5872,6 +5872,8 @@ static bool enqueue_throttled_task(struct task_struct *p)
> */
> if (throttled_hierarchy(cfs_rq) &&
> !task_current_donor(rq_of(cfs_rq), p)) {
/*
* Make sure to throttle this cfs_rq or it can be unthrottled
* with no runtime_remaining and gets throttled again on its
* unthrottle path.
*/
> + if (list_empty(&cfs_rq->throttled_limbo_list))
> + check_enqueue_throttle(cfs_rq);
BTW, do you think a comment is needed? Something like the above, not
sure if it's too redundant though, feel free to let me know your
thoughts, thanks.
> list_add(&p->throttle_node, &cfs_rq->throttled_limbo_list);
> return true;
> }
> ---