[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fWZpfo62iN3YWWKm_VZZqMFCyddyg_JQTGe7j6nV+DbmQ@mail.gmail.com>
Date: Thu, 30 Mar 2023 09:59:08 -0700
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, James Clark <james.clark@....com>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
German Gomez <german.gomez@....com>,
Sandipan Das <sandipan.das@....com>,
Andres Freund <andres@...razel.de>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH v1 1/6] perf annotate: Delete session for debug builds
On Thu, Mar 30, 2023 at 4:24 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> Em Wed, Mar 29, 2023 at 05:13:17PM -0700, Namhyung Kim escreveu:
> > On Wed, Mar 29, 2023 at 6:18 AM Arnaldo Carvalho de Melo
> > <acme@...nel.org> wrote:
> > >
> > > Em Wed, Mar 29, 2023 at 10:09:48AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Tue, Mar 28, 2023 at 04:55:38PM -0700, Ian Rogers escreveu:
> > > > > Use the debug build indicator as the guide to free the session. This
> > > > > implements a behavior described in a comment, which is consequentially
> > > > > removed.
> > > > >
> > > > > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > > > > ---
> > > > > tools/perf/builtin-annotate.c | 16 ++++++----------
> > > > > 1 file changed, 6 insertions(+), 10 deletions(-)
> > > > >
> > > > > diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> > > > > index 4750fac7bf93..98d1b6379230 100644
> > > > > --- a/tools/perf/builtin-annotate.c
> > > > > +++ b/tools/perf/builtin-annotate.c
> > > > > @@ -692,16 +692,12 @@ int cmd_annotate(int argc, const char **argv)
> > > > >
> > > > > out_delete:
> > > > > /*
> > > > > - * Speed up the exit process, for large files this can
> > > > > - * take quite a while.
> > > > > - *
> > > > > - * XXX Enable this when using valgrind or if we ever
> > > > > - * librarize this command.
> > > > > - *
> > > > > - * Also experiment with obstacks to see how much speed
> > > > > - * up we'll get here.
> > > > > - *
> > > > > - * perf_session__delete(session);
> > > > > + * Speed up the exit process by only deleting for debug builds. For
> > > > > + * large files this can save time.
> > > > > */
> > > > > +#ifndef NDEBUG
> > > > > + perf_session__delete(annotate.session);
> > > > > +#endif
> > > >
> > > > So now, but default, we will call this, as we don't have this defined
> > > > only if DEBUG=1 is set, right?
> > > >
> > > > ⬢[acme@...lbox perf-tools-next]$ find tools/perf/ -type f | xargs grep NDEBUG
> > > > tools/perf/util/mutex.c:#ifndef NDEBUG
> > > > ⬢[acme@...lbox perf-tools-next]$
> > >
> > > We can discuss this later, applied the series with just that zfree()
> > > change to annotation_options__exit().
> >
> > I don't think it's just an issue in the perf annotate. Maybe we can
> > do the same for perf report and so on.
>
> Yes, I thought at some point of setting some flag, perf_exiting, and
> then we would stop releasing memory, zfree comes to mind, but then we
> would still be traversing data structures, taking locks, etc.
>
> And we can't just exit() as we may need to flush caches, etc.
>
> IIRC this specific case appeared in profiles, so was commented out.
>
> > Anyway we could define NDEBUG=1 for release builds from now on.
>
> Yes, we should do it.
I'll send out a patch. Just a heads up that this will also disable
asserts for non-debug builds.
Thanks,
Ian
> - Arnaldo
Powered by blists - more mailing lists