Re: [PATCH] sched/fair: Prevent cfs_rq from being unthrottled with zero runtime_remaining
From: K Prateek Nayak
Date: Tue Sep 30 2025 - 09:38:32 EST
Hello Aaron,
I'll merge the two replies in one.
On 9/30/2025 4:37 PM, Aaron Lu wrote:
> So in my original patch, cfs_rqs will (most likely) start with
> runtime_remaining == 1 and unthrottled after calling throttle_cfs_rq(),
> which will also start the B/W timer. The timer is not needed in this
> case when no cfs_rqs are actually throttled but it doesn't hurt. Looks
> like everything is OK, we do not need to do any special handling in
> enqueue_throttled_task(). Thoughts?
Now that I look at throttle_cfs_rq() properly, we'll only move the
runtime_remaining from 0 to 1 so few usecs worth of bandwidth
distributed at max should be okay. Sorry for the being overly cautious!
So your current approach should be good. Please feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
As for the other thread:
On 9/30/2025 6:09 PM, Aaron Lu wrote:
>>>
>>> root -> A (throttled) -> B -> C
>>>
>>> Consider B has runtime_remaining = 0, and subsequently a throttled task
>>> is queued onto C. Ideally, we should start the B/W timer for B at that
>>> point but we bail out after queuing it on C. Thoughts?
>>
>> Yes agree the B/W timer should also be considered.
>
> On another thought, do we really need care about B/W timer for B?
>
> I mean, when C is unthrottled and gets enqueued on B,
> check_enqueue_throttle() will do the right thing for B so I don't
> think we need to do this hierarchy check_enqueue_throttle() here.
So what I though would happen here is that when A is unthrottled,
you'll enqueue the task and only then realize B doesn't have any
bandwidth and start the timer then but had you identified it
earlier, distribution could have already added some bandwidth to
B and then you could run the task without adding any further
latency.
--
Thanks and Regards,
Prateek