提交 1c5ab7a7 编写于 作者: Y Yihao Wu

alinux: sched: Fix %steal in cpuacct.proc_stat in guest OS

to #28143829

rq_clock_task is less than rq_clock when in VM, or when IRQ_TIME_ACCOUNTING
is on. So they are not comparable when accounting elapsed time. This bug is
not observed on host yet, because neither of these two conditions are met.

Use rq_clock at both begin and end of exec_start_raw accumulation to fix
this bug, because we expect steal% in cpuacct.proc_stat of VM's cgroups can
reflect the cpu time the host steal from the guest.

Fixes: c7552980 ("alinux: sched: Introduce per-cgroup steal accounting")
Signed-off-by: NYihao Wu <wuyihao@linux.alibaba.com>
Acked-by: NMichael Wang <yun.wang@linux.alibaba.com>
上级 54fce2ae
......@@ -1023,7 +1023,7 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
* We are starting a new run period:
*/
se->exec_start = rq_clock_task(rq_of(cfs_rq));
se->exec_start_raw = rq_clock_task(rq_of(cfs_rq));
se->exec_start_raw = rq_clock(rq_of(cfs_rq));
}
/**************************************************
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册