From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Yang Jihong <yangjihong1@huawei.com>,
Carsten Haitzler <carsten.haitzler@arm.com>,
Changbin Du <changbin.du@huawei.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Jason Wang <wangborong@cdjrlc.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf symbol: Remove symbol_name_rb_node
Date: Tue, 20 Jun 2023 17:14:35 -0700 [thread overview]
Message-ID: <CAM9d7chMS5b=CUSAZS7g8-GO09sf578nx6yUJH7_niqwux8jYw@mail.gmail.com> (raw)
In-Reply-To: <CAP-5=fW5ET9S=bOA2RX0YNds+V-B5VUeYC_AB-bFr9DHKKnvjQ@mail.gmail.com>
On Tue, Jun 20, 2023 at 3:55 PM Ian Rogers <irogers@google.com> wrote:
>
> On Tue, Jun 20, 2023 at 2:01 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hi Ian,
> >
> > On Thu, Jun 15, 2023 at 1:08 PM Ian Rogers <irogers@google.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
prev parent reply other threads:[~2023-06-21 0:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 20:08 [PATCH v1] perf symbol: Remove symbol_name_rb_node Ian Rogers
2023-06-20 21:00 ` Namhyung Kim
2023-06-20 22:55 ` Ian Rogers
2023-06-21 0:14 ` 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='CAM9d7chMS5b=CUSAZS7g8-GO09sf578nx6yUJH7_niqwux8jYw@mail.gmail.com' \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=carsten.haitzler@arm.com \
--cc=changbin.du@huawei.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=wangborong@cdjrlc.com \
--cc=yangjihong1@huawei.com \
/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).