All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Lin Xiulei <linxiulei@gmail.com>
Cc: yang_oliver@hotmail.com, Peter Zijlstra <peterz@infradead.org>,
	mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, Stephane Eranian <eranian@gmail.com>,
	torvalds@linux-foundation.org,
	"leilei.lin" <leilei.lin@alibaba-inc.com>
Subject: Re: [PATCH] perf/core: Update cgroup time with descendants
Date: Tue, 19 Sep 2017 10:48:07 +0200	[thread overview]
Message-ID: <20170919084807.GB4231@krava> (raw)
In-Reply-To: <CALPjY3ko2MUYFBgfT9QqZFqGe+G=jTWhs9zb+KjDS8s32K9pkA@mail.gmail.com>

On Tue, Sep 19, 2017 at 10:02:50AM +0800, Lin Xiulei wrote:
> Add steps of reproducing
> 
> 1
> ```
> mkdir /sys/fs/cgroup/perf_event/root1
> mkdir /sys/fs/cgroup/perf_event/root1/leaf1
> ```
> 2  $pid is any running process
> ```
> echo $pid > /sys/fs/cgroup/perf_event/root1/cgroup.procs
> ```
> 
> 3
> ```
> perf stat -e cycles -G root1 -a -I 1000
> ```
> 
> You shall get 0 cycles from it, which should have been cycles of $pid
> 
> 2017-09-14 15:03 GMT+08:00  <linxiulei@gmail.com>:
> > From: "leilei.lin" <leilei.lin@alibaba-inc.com>
> >
> > This fix updating cgroup time when event is being scheduled in
> > by cgroup descendants
> >
> > Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
> > ---
> >  kernel/events/core.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 3e691b7..6f6bd1e 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -662,7 +662,9 @@ static inline void update_cgrp_time_from_event(struct perf_event *event)
> >         /*
> >          * Do not update time when cgroup is not active
> >          */
> > -       if (cgrp == event->cgrp)
> > +       if (cgrp == event->cgrp ||
> > +               cgroup_is_descendant(cgrp->css.cgroup,
> > +                       event->cgrp->css.cgroup))
> >                 __update_cgrp_time(event->cgrp);

you no longer need the 'cgrp == event->cgrp', it's part
of the cgroup_is_descendant call

other than that it looks ok to me

Reviewed-and-tested-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

      reply	other threads:[~2017-09-19  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  7:03 [PATCH] perf/core: Update cgroup time with descendants linxiulei
2017-09-19  2:02 ` Lin Xiulei
2017-09-19  8:48   ` Jiri Olsa [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=20170919084807.GB4231@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@gmail.com \
    --cc=leilei.lin@alibaba-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linxiulei@gmail.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yang_oliver@hotmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.