linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	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:26:58 +0900	[thread overview]
Message-ID: <CAM9d7cgBbSEy9r+Kh5-06bTii5GED81gdtYiJ7AOkQKo9NbVhw@mail.gmail.com> (raw)
In-Reply-To: <20201127154557.GB2729821@krava>

Hi Jiri,

On Sat, Nov 28, 2020 at 12:46 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> 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

Actually I just copied the namespace code. :).
It's only called from perf record and top, and neither of them pass NULL.

>
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks,
Namhyung

      parent reply	other threads:[~2020-11-30 13:27 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
2020-11-30 13:26   ` Namhyung Kim [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=CAM9d7cgBbSEy9r+Kh5-06bTii5GED81gdtYiJ7AOkQKo9NbVhw@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).