Commit f5f92020 authored by Muchun Song's avatar Muchun Song Committed by Xia Fukun
Browse files

sched/cpuacct: Fix charge cpuacct.usage_sys

mainline inclusion
from mainline-v6.5-rc7
commit dbe93371
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8BN4B


CVE: NA

--------------------------------

The user_mode(task_pt_regs(tsk)) always return true for
user thread, and false for kernel thread. So it means that
the cpuacct.usage_sys is the time that kernel thread uses
not the time that thread uses in the kernel mode. We can
try get_irq_regs() first, if it is NULL, then we can fall
back to task_pt_regs().

Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200420070453.76815-1-songmuchun@bytedance.com


Signed-off-by: default avatarXia Fukun <xiafukun@huawei.com>
parent 19ac6490
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment