提交 1a66de65 编写于 作者: X Xie XiuQi 提交者: Yang Yingliang

kernel/cputime: do not update cputime when cpu offline

hulk inclusion
category: bugfix
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=37
CVE: NA

If we enable 'use_sched_idle_time' at commend line, when
possile cpus > online cpus, we get the uncorrected idle
time. Return the pervious sum_idle_time to avoid this
issue.
Signed-off-by: NXie XiuQi <xiexiuqi@huawei.com>
Tested-by: NYu Xiangyang <yuxiangyang4@huawei.com>
Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 16f3032a
......@@ -649,6 +649,10 @@ unsigned long long sched_get_idle_time(int cpu)
struct rq_cputime *rt = &per_cpu(rq_cputimes, cpu);
u64 hi = 0, si = 0;
/* Do not update cpu time when cpu offline */
if (!cpu_online(cpu))
return rt->sum_idle_time;
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
if (sched_clock_irqtime) {
hi = kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ_IDLE];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册