[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7chMS5b=CUSAZS7g8-GO09sf578nx6yUJH7_niqwux8jYw@mail.gmail.com>
Date: Tue, 20 Jun 2023 17:14:35 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Yang Jihong <yangjihong1@...wei.com>,
Carsten Haitzler <carsten.haitzler@....com>,
Changbin Du <changbin.du@...wei.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Jason Wang <wangborong@...rlc.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf symbol: Remove symbol_name_rb_node
On Tue, Jun 20, 2023 at 3:55 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Tue, Jun 20, 2023 at 2:01 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Hi Ian,
> >
> > On Thu, Jun 15, 2023 at 1:08 PM Ian Rogers <irogers@...gle.com> wrote:
> > >
> > > Most perf commands want to sort symbols by name and this is done via
> > > an invasive rbtree that on 64-bit systems costs 24 bytes. Sorting the
> > > symbols in a DSO by name is optional and not done by default, however,
> > > if sorting is requested the 24 bytes is allocated for every
> > > symbol.
> > >
> > > This change removes the rbtree and uses a sorted array of symbol
> > > pointers instead (costing 8 bytes per symbol). As the array is created
> > > on demand then there are further memory savings. The complexity of
> > > sorting the array and using the rbtree are the same.
> >
> > Nice, I like the savings and lazy allocation.
> >
> > >
> > > To support going to the next symbol, the index of the current symbol
> > > needs to be passed around as a pair with the current symbol. This
> > > requires some API changes.
> >
> > But I'm not sure if we need the index for the normal use cases.
> > IIUC only one place to require it: map__for_each_symbol_by_name.
> > Maybe we can have a separate API for it?
> >
> > In general, I'd like to split the commit to have on-demand part and
> > array changes separately.
>
> Thanks Namhyung! The current code is on-demand but the space for the
> rbnode must be reserved in the symbol_name_rb_node. We could on-demand
> resize symbols, but I don't think it makes sense.
Ok, but I think we can split the symbol_conf changes at least.
>
> If the worry is the patch set size, maybe as you suggest, we keep
> find_symbol_by_name to not take the optional index output parameter
> and introduce a find_symbol_by_name_idx function that takes a required
> index parameter. If that's good I'll send a v2.
Right, the patch size is a concern. But IIUC the find-by-name API
has two different use cases. So better splitting them for clarity.
Thanks,
Namhyung
Powered by blists - more mailing lists