Skip to contentSkip to conversation

cpuacct_charge() problem

sched/core Pavel V. Panteleev 1 participant 1 message Nov 9, 2017

lore
Share & tools
lore
#0 lore raw

Hello!

task_pt_regs() always show on the user regs for user thread, even if it's working in kernel mode now. So, index calculation in cpuacct_charge() isn't correct and it's always CPUACCT_STAT_USER for user thread. The time, spent in kernel mode for user task, will be lost:

int index = CPUACCT_STAT_SYSTEM;
struct pt_regs *regs = task_pt_regs(tsk);

if (regs && user_mode(regs))

    index = CPUACCT_STAT_USER;