From 17edb7eddfe9f4165a6430f7d8e2b3546854275c Mon Sep 17 00:00:00 2001 From: Wenyu Huang Date: Fri, 29 Nov 2024 12:02:59 +0800 Subject: [PATCH] Fix SCHED_WARN_ON(cfs_rq->throttled_clock) in throttle_cfs_rq hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB7FU1 -------------------------------- In enqueue_entity, it assigns rq_clock(rq) to a cfs_rq when this cfs_rq is throttled by QOS, which causes SCHED_WARN_ON(cfs_rq->throttled_clock) in throttle_cfs_rq. So we add a "cfs_rq->throttled != QOS_THROTTLED" check to avoid assign rq_clock to the cfs_rq throttled by QOS. Fixes: 926b9b0cd97e ("sched: Throttle qos cfs_rq when current cpu is running online task") Signed-off-by: Wenyu Huang Signed-off-by: Liu Kai --- kernel/sched/fair.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2ef32e806f54..d1cd862ad0a1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5466,13 +5466,19 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) if (!throttled_hierarchy(cfs_rq)) { list_add_leaf_cfs_rq(cfs_rq); } else { +#ifdef CONFIG_QOS_SCHED + if (cfs_rq->throttled != QOS_THROTTLED) { +#endif #ifdef CONFIG_CFS_BANDWIDTH - struct rq *rq = rq_of(cfs_rq); + struct rq *rq = rq_of(cfs_rq); - if (cfs_rq_throttled(cfs_rq) && !cfs_rq->throttled_clock) - cfs_rq->throttled_clock = rq_clock(rq); - if (!cfs_rq->throttled_clock_self) - cfs_rq->throttled_clock_self = rq_clock(rq); + if (cfs_rq_throttled(cfs_rq) && !cfs_rq->throttled_clock) + cfs_rq->throttled_clock = rq_clock(rq); + if (!cfs_rq->throttled_clock_self) + cfs_rq->throttled_clock_self = rq_clock(rq); +#endif +#ifdef CONFIG_QOS_SCHED + } #endif } } -- Gitee