[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cgBbSEy9r+Kh5-06bTii5GED81gdtYiJ7AOkQKo9NbVhw@mail.gmail.com>
Date: Mon, 30 Nov 2020 22:26:58 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>,
Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH] perf record: Synthesize cgroup events only if needed
Hi Jiri,
On Sat, Nov 28, 2020 at 12:46 AM Jiri Olsa <jolsa@...hat.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@...nel.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@...hat.com>
Thanks,
Namhyung
Powered by blists - more mailing lists