linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: "Li,Rongqing" <lirongqing@baidu.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
	"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
	"dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"bsegall@google.com" <bsegall@google.com>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"bristot@redhat.com" <bristot@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"songmuchun@bytedance.com" <songmuchun@bytedance.com>,
	"Michal Koutný" <mkoutny@suse.com>
Subject: Re: 答复: 答复: [PATCH][RFC] sched/cpuacct: Fix cpuacct charge
Date: Wed, 18 Aug 2021 11:33:39 -0400	[thread overview]
Message-ID: <20210818153339.a7kz4irqbzk32pyi@oracle.com> (raw)
In-Reply-To: <06265d4d0df7410786d0ddb9bdbc4e4c@baidu.com>

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.

      reply	other threads:[~2021-08-18 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  6:04 [PATCH][RFC] sched/cpuacct: Fix cpuacct charge Li RongQing
2021-07-29 10:19 ` Peter Zijlstra
2021-07-30  8:16   ` 答复: " Li,Rongqing
2021-08-16 16:21     ` Daniel Jordan
2021-08-17  3:55       ` 答复: " Li,Rongqing
2021-08-18 15:33         ` Daniel Jordan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210818153339.a7kz4irqbzk32pyi@oracle.com \
    --to=daniel.m.jordan@oracle.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=songmuchun@bytedance.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).