[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210818153339.a7kz4irqbzk32pyi@oracle.com>
Date: Wed, 18 Aug 2021 11:33:39 -0400
From: Daniel Jordan <daniel.m.jordan@...cle.com>
To: "Li,Rongqing" <lirongqing@...du.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"juri.lelli@...hat.com" <juri.lelli@...hat.com>,
"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
"dietmar.eggemann@....com" <dietmar.eggemann@....com>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"bsegall@...gle.com" <bsegall@...gle.com>,
"mgorman@...e.de" <mgorman@...e.de>,
"bristot@...hat.com" <bristot@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"songmuchun@...edance.com" <songmuchun@...edance.com>,
Michal Koutný <mkoutny@...e.com>
Subject: Re: 答复: 答复: [PATCH][RFC]
sched/cpuacct: Fix cpuacct charge
On Tue, Aug 17, 2021 at 03:55:08AM +0000, Li,Rongqing wrote:
> > > diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index
> > > 893eece..48b117e 100644
> > > --- a/kernel/sched/cpuacct.c
> > > +++ b/kernel/sched/cpuacct.c
> > > @@ -340,7 +340,12 @@ void cpuacct_charge(struct task_struct *tsk, u64
> > > cputime) {
> > > struct cpuacct *ca;
> > > int index = CPUACCT_STAT_SYSTEM;
> > > - struct pt_regs *regs = get_irq_regs() ? : task_pt_regs(tsk);
> > > + struct pt_regs *regs;
> > > +
> > > + if (task_cpu(tsk) == raw_smp_processor_id())
> > > + regs = get_irq_regs() ? : task_pt_regs(tsk);
> > > + else
> > > + regs = task_pt_regs(tsk);
> > >
> > > if (regs && user_mode(regs))
> > > index = CPUACCT_STAT_USER;
> >
> > It still suffers from task_pt_regs().
> >
> > Why not make cpuacct use cgroup2's approach? Remember only delta_exec
> > here, then on reading cpuacct.usage_*, use cputime_adjust() to scale the
> > user/sys from cpuacct_account_field().
> >
>
> I think your suggestion is reasonable, Could you send a patch
I'll leave that to someone else, got other things going on for now.
Powered by blists - more mailing lists