Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbe9337

Browse files
Muchun SongPeter Zijlstra
Muchun Song
authored and
Peter Zijlstra
committed
sched/cpuacct: Fix charge cpuacct.usage_sys
The user_mode(task_pt_regs(tsk)) always return true foruser thread, and false for kernel thread. So it means thatthe cpuacct.usage_sys is the time that kernel thread usesnot the time that thread uses in the kernel mode. We cantry get_irq_regs() first, if it is NULL, then we can fallback to task_pt_regs().Signed-off-by: Muchun Song <songmuchun@bytedance.com>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Link:https://lkml.kernel.org/r/20200420070453.76815-1-songmuchun@bytedance.com
1 parent04f5c36 commitdbe9337

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎kernel/sched/cpuacct.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Based on the work by Paul Menage (menage@google.com) and Balbir Singh
66
* (balbir@in.ibm.com).
77
*/
8+
#include<asm/irq_regs.h>
89
#include"sched.h"
910

1011
/* Time spent by the tasks of the CPU accounting group executing in ... */
@@ -339,7 +340,7 @@ void cpuacct_charge(struct task_struct *tsk, u64 cputime)
339340
{
340341
structcpuacct*ca;
341342
intindex=CPUACCT_STAT_SYSTEM;
342-
structpt_regs*regs=task_pt_regs(tsk);
343+
structpt_regs*regs=get_irq_regs() ? :task_pt_regs(tsk);
343344

344345
if (regs&&user_mode(regs))
345346
index=CPUACCT_STAT_USER;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp