lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cixNAgxU58YNLHOpdZzDqk1t_ypOCQKEyo8+chFHd1HrQ@mail.gmail.com>
Date:   Wed, 21 Jun 2023 22:21:12 -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 v2 1/2] perf symbol: Remove symbol_name_rb_node

On Wed, Jun 21, 2023 at 9:28 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Wed, Jun 21, 2023 at 8:51 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Hi Ian,
> >
> > On Tue, Jun 20, 2023 at 11:37 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.
> > >
> > > 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.
> > >
> > > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > >
> > > v2. map__find_symbol_by_name_idx so that map__find_symbol_by_name
> > >     doesn't need an optional parameter. Separate out
> > >     symbol_conf.sort_by_name removal.
> > > ---
> >
> > [SNIP]
> > >  void dso__sort_by_name(struct dso *dso)
> > >  {
> > > -       dso__set_sorted_by_name(dso);
> > > -       return symbols__sort_by_name(&dso->symbol_names, &dso->symbols);
> > > +       mutex_lock(&dso->lock);
> > > +       if (!dso__sorted_by_name(dso)) {
> > > +               size_t len;
> > > +
> > > +               dso->symbol_names = symbols__sort_by_name(&dso->symbols, &len);
> > > +               if (dso->symbol_names) {
> > > +                       dso->symbol_names_len = len;
> > > +                       dso__set_sorted_by_name(dso);
> > > +               }
> > > +       }
> > > +       mutex_unlock(&dso->lock);
> >
> > I think this part deserves a separate commit.
>
> Using the mutex or the use of sorted_by_name?

For the mutex originally, but might be better to split further. :)

And now it grabs the mutex unconditionally, I think
we can check the condition without the mutex first
and again with the mutex if not sorted.

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ