mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
sched/fair: Use cfs_rq->h_curr in throttle_cfs_rq()
After commit85570f10a4("sched/eevdf: Move to a single runqueue"), cfs_rq->curr is only maintained on the root cfs_rq (set/cleared from set_next_task_fair()/put_prev_task_fair()), while cfs_rq->h_curr is the per-level current entity, set by set_next_entity() at every level of the hierarchy. For an intermediate cfs_rq (a cgroup), cfs_rq->curr is always NULL, but cfs_rq->h_curr is the group entity at that level. throttle_cfs_rq() reads cfs_rq->curr to decide whether there is a running entity at the throttled level, in which case it should request a full sched_cfs_bandwidth_slice() of runtime and arm the deferred throttle task_work via task_throttle_setup_work(). For intermediate cfs_rqs the check is always false, so bandwidth-controlled cgroups always get just 1ns of runtime and never arm the deferred throttle work; the running task then escapes throttling until the next pick arms the work instead, even though there is an on-rq entity at this level. Switch the read to cfs_rq->h_curr so intermediate bandwidth-controlled cgroups behave consistently with the root cfs_rq, matching the existing usage of cfs_rq->h_curr in update_curr() and check_enqueue_throttle(). Fixes:85570f10a4("sched/eevdf: Move to a single runqueue") Signed-off-by: Wanwu Li <liwanwu@kylinos.cn> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Aaron Lu <ziqianlu@bytedance.com> Tested-by: Aaron Lu <ziqianlu@bytedance.com> Link: https://patch.msgid.link/20260831101141.391382-2-liwanwu@kylinos.cn
This commit is contained in:
parent
c6dcd97c8b
commit
f8610c57f4
|
|
@ -6978,14 +6978,14 @@ static int tg_throttle_down(struct task_group *tg, void *data)
|
|||
static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)
|
||||
{
|
||||
struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg);
|
||||
struct sched_entity *curr = cfs_rq->curr;
|
||||
struct sched_entity *curr = cfs_rq->h_curr;
|
||||
struct rq *rq = rq_of(cfs_rq);
|
||||
|
||||
scoped_guard(raw_spinlock, &cfs_b->lock) {
|
||||
u64 target_runtime = 1;
|
||||
|
||||
/*
|
||||
* If cfs_rq->curr is still runnable, we are here from an
|
||||
* If cfs_rq->h_curr is still runnable, we are here from an
|
||||
* update_curr(). Request sysctl_sched_cfs_bandwidth_slice
|
||||
* worth of bandwidth to continue running.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user