
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IBGRJE -------------------------------- If an offline group exists and its parent group has a configured quota, and if there are other online groups running in the parent group, when the online groups are fully loaded and able to claim all of the parent group's time slices, once the online groups exhaust all of the parent group's time slices, the offline group will not be able to get scheduled. So, if the parent group of this offline group is throttled, we will not cancel the qos timer, which would otherwise remove the throttling of the offline group by the online group, ensuring that the offline group can still be scheduled. Signed-off-by: Liu Kai <liukai284@huawei.com> --- kernel/sched/fair.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d8a6686774ea..eb8037d36b7e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9566,17 +9566,22 @@ static void unthrottle_qos_cfs_rq(struct cfs_rq *cfs_rq) static int __unthrottle_qos_cfs_rqs(int cpu) { struct cfs_rq *cfs_rq, *tmp_rq; - int res = 0; + int all_is_runnable = 1; + + if (list_empty(&per_cpu(qos_throttled_cfs_rq, cpu))) + return 0; list_for_each_entry_safe(cfs_rq, tmp_rq, &per_cpu(qos_throttled_cfs_rq, cpu), qos_throttled_list) { if (cfs_rq_throttled(cfs_rq)) { unthrottle_qos_cfs_rq(cfs_rq); - res++; } + + if (throttled_hierarchy(cfs_rq)) + all_is_runnable = 0; } - return res; + return all_is_runnable; } static int unthrottle_qos_cfs_rqs(int cpu) @@ -9584,9 +9589,14 @@ static int unthrottle_qos_cfs_rqs(int cpu) int res; res = __unthrottle_qos_cfs_rqs(cpu); - if (qos_timer_is_activated(cpu) && !qos_smt_expelled(cpu)) + /* + * We should not cancel the timer if there is still a cfs_rq + * throttling after __unthrottle_qos_cfs_rqs(). + */ + if (res && qos_timer_is_activated(cpu) && !qos_smt_expelled(cpu)) cancel_qos_timer(cpu); - return res; + + return cpu_rq(cpu)->cfs.h_nr_running; } static bool check_qos_cfs_rq(struct cfs_rq *cfs_rq) -- 2.34.1