hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDA3VP ----------------------------------------- When a cgroup contains multiple running tasks, the group virtual runtime was previously updated using the xruntime of the first runnable entity multiplied by the group weight. This causes the effective bandwidth to deviate from the configured shares. Update the group virtual runtime calculation to use the accumulated sum_exec_runtime of the group instead, so that the observed compute share matches the configured shares more accurately. Fixes: 43bbefc53356 ("xsched: Add XCU control group implementation and its backend in xsched CFS") Signed-off-by: Zicheng Qu <quzicheng@huawei.com> --- kernel/xsched/cfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/xsched/cfs.c b/kernel/xsched/cfs.c index 1cbfd5f0e586..883ba6974450 100644 --- a/kernel/xsched/cfs.c +++ b/kernel/xsched/cfs.c @@ -107,7 +107,10 @@ static void xg_update(struct xsched_group_xcu_priv *xg, int task_delta) for (; xg; xg = &xcg_parent_grp_xcu(xg)) { xg->cfs_rq->nr_running += task_delta; entry = xs_pick_first(xg->cfs_rq); - new_xrt = entry ? entry->xruntime * xg->xse.cfs.weight : XSCHED_TIME_INF; + if (entry) + new_xrt = xg->xse.cfs.sum_exec_runtime * xg->xse.cfs.weight; + else + new_xrt = XSCHED_TIME_INF; xg->cfs_rq->min_xruntime = new_xrt; xg->xse.cfs.xruntime = new_xrt; -- 2.34.1