[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cjfH7e5wiM9Zwfn_oCqL1tUvy1=c3RUuO=zvgTJVrU6oQ@mail.gmail.com>
Date: Wed, 6 Mar 2024 20:20:15 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v2 0/4] perf annotate: Improve memory usage for symbol histogram
On Wed, Mar 6, 2024 at 2:22 PM Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
>
> On Mon, Mar 04, 2024 at 03:08:11PM -0800, Namhyung Kim wrote:
> > Hello,
> >
> > This is another series of memory optimization in perf annotate.
> >
> > v2 changes:
> > * fix a bug when offset is bigger than 16 bits
> >
> >
> > When perf annotate (or perf report/top with TUI) processes samples, it
> > needs to save the sample period (overhead) at instruction level. For
> > now, it allocates an array to do that for the whole symbol when it
> > hits any new symbol. This comes with a lot of waste since samples can
> > be very few and instructions span to multiple bytes.
> >
> > For example, when a sample hits symbol 'foo' that has size of 100 and
> > that's the only sample falls into the symbol. Then it needs to
> > allocate a symbol histogram (sym_hist) and the its size would be
> >
> > 16 (header) + 16 (sym_hist_entry) * 100 (symbol_size) = 1616
> >
> > But actually it just needs 32 (header + sym_hist_entry) bytes. Things
> > get worse if the symbol size is bigger (and it doesn't have many
> > samples in different places). Also note that it needs a separate
> > histogram for each event.
> >
> > Let's split the sym_hist_entry and have it in a hash table so that it
> > can allocate only necessary entries.
> >
> > No functional change intended.
> >
> > Thanks,
> > Namhyung
>
> No difference before/after on that 'perf annotate --stdio2' for all
> binaries in a perf record of building perf using the default binutils
> objdump disassembler, etc.
>
> Reviewed-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Great, thanks for testing.
Namhyung
Powered by blists - more mailing lists