Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
anolis: sched: fix race condition when adjust guest cputime
ANBZ: torvalds#394 Cpuacct.proc_stat_show callback will read cpuacct's per-cpu kcpustat by `per_cpu_ptr`. the `kcpustats` is not protected by any lock. When adjust guest cputime, it will subtract tick_user by tick_guest. In a extreme case, the tick_user version is older than tick_guest, if the tick_guest value close the tick_user, the result will be negative. cpu0 | cpu1 __cpuacct_get_usage_result: | per_cpu_ptr(ca->cpustat, 1); | read tick_user | | update tick_user and tick_guest read tick_guest | tick_user - tick_guest | Fixes: a1bc632 (anolis: cpuacct: fix guest cgroup usage more than user usage) Signed-off-by: Zeng Jiahao <zengjiahao@linux.alibaba.com> Reviewed-by: Shanpei Chen <shanpeic@linux.alibaba.com>
- Loading branch information