linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH] perf record: Synthesize cgroup events only if needed
Date: Mon, 30 Nov 2020 22:27:59 +0900	[thread overview]
Message-ID: <CAM9d7chmmB9=2-npHr8WnyA6jHqxQ+rf3jix+cHoa2C+3C9YJQ@mail.gmail.com> (raw)
In-Reply-To: <20201127173021.GN70905@kernel.org>

Hi Arnaldo,

On Sat, Nov 28, 2020 at 2:30 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Fri, Nov 27, 2020 at 04:45:57PM +0100, Jiri Olsa escreveu:
> > On Fri, Nov 27, 2020 at 02:43:56PM +0900, Namhyung Kim wrote:
> > > It didn't check the tool->cgroup_events bit which is set when
> > > the --all-cgroups option is given.  Without it, samples will not have
> > > cgroup info so no reason to synthesize.
> > >
> > > We can check the PERF_RECORD_CGROUP records after running perf record
> > > *WITHOUT* the --all-cgroups option:
> > >
> > > Before:
> > >   $ perf report -D | grep CGROUP
> > >   0 0 0x8430 [0x38]: PERF_RECORD_CGROUP cgroup: 1 /
> > >           CGROUP events:          1
> > >           CGROUP events:          0
> > >           CGROUP events:          0
> > >
> > > After:
> > >   $ perf report -D | grep CGROUP
> > >           CGROUP events:          0
> > >           CGROUP events:          0
> > >           CGROUP events:          0
> > >
> > > Fixes: 8fb4b67939e16 ("perf record: Add --all-cgroups option")
> > > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > > ---
> > >  tools/perf/util/synthetic-events.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> > > index 8a23391558cf..d9c624377da7 100644
> > > --- a/tools/perf/util/synthetic-events.c
> > > +++ b/tools/perf/util/synthetic-events.c
> > > @@ -563,6 +563,9 @@ int perf_event__synthesize_cgroups(struct perf_tool *tool,
> > >     char cgrp_root[PATH_MAX];
> > >     size_t mount_len;  /* length of mount point in the path */
> > >
> > > +   if (!tool || !tool->cgroup_events)
> > > +           return 0;
> >
> > can !tool actually happen here? or it's just being extra cautious
> >
> > Acked-by: Jiri Olsa <jolsa@redhat.com>
>
> Thanks, tested with/without --all-cgroups and applied.

Thanks for doing that!

Namhyung

  reply	other threads:[~2020-11-30 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27  5:43 [PATCH] perf record: Synthesize cgroup events only if needed Namhyung Kim
2020-11-27 15:45 ` Jiri Olsa
2020-11-27 17:30   ` Arnaldo Carvalho de Melo
2020-11-30 13:27     ` Namhyung Kim [this message]
2020-11-30 13:26   ` Namhyung Kim

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='CAM9d7chmmB9=2-npHr8WnyA6jHqxQ+rf3jix+cHoa2C+3C9YJQ@mail.gmail.com' \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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).