lkml.org 
[lkml]   [2016]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage
Date
Hi, Anton and Peter

> -----Original Message-----
> From: Peter Zijlstra [mailto:peterz@infradead.org]
> Sent: Wednesday, April 06, 2016 7:08 PM
> To: Anton Blanchard <anton@samba.org>
> Cc: Ingo Molnar <mingo@kernel.org>; Srikar Dronamraju
> <srikar@linux.vnet.ibm.com>; tglx@linutronix.de; efault@gmx.de;
> htejun@gmail.com; linux-kernel@vger.kernel.org; tj@kernel.org;
> torvalds@linux-foundation.org; zhaolei@cn.fujitsu.com;
> yangds.fnst@cn.fujitsu.com; hpa@zytor.com; Stephen Rothwell
> <sfr@canb.auug.org.au>; Michael Ellerman <mpe@ellerman.id.au>
> Subject: Re: [tip:sched/core] sched/cpuacct: Split usage accounting into
> user_usage and sys_usage
>
> On Wed, Apr 06, 2016 at 08:32:19PM +1000, Anton Blanchard wrote:
> > Hi,
> >
> > > > > void cpuacct_charge(struct task_struct *tsk, u64 cputime)
> > > > > {
> > > > > struct cpuacct *ca;
> > > > > + int index;
> > > > > +
> > > > > + if (user_mode(task_pt_regs(tsk)))
> > > > > + index = CPUACCT_USAGE_USER;
> > > > > + else
> > > > > + index = CPUACCT_USAGE_SYSTEM;
> >
> > This is oopsing because PowerPC task_pt_regs() returns NULL for
> > kernel threads.
>
Thanks for notice it.

> Ah, so sometihng like:
>
> struct pt_regs *regs = task_pt_regs();
> int index = CPUACCT_USAGE_SYSTEM;
>
> if (regs && user_mode(regs))
> index = CPUACCT_USAGE_USER;
>
> should work, right?
>
Thanks, I'll confirm it in a Power7 VM from buildroot.
(maybe need some hours or till tomorrow in a poor pc...)

Btw, I reproduced this bug in above vm.

Thanks
Zhaolei


>




\
 
 \ /
  Last update: 2016-04-06 14:01    [W:0.094 / U:0.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site