From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org, Waiman Long <Waiman.Long@hp.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Don Zickus <dzickus@redhat.com>,
Douglas Hatch <doug.hatch@hp.com>, Ingo Molnar <mingo@redhat.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Scott J Norton <scott.norton@hp.com>
Subject: Re: [PATCH 6/8] perf symbols: Improve DSO long names lookup speed with rbtree
Date: Tue, 14 Oct 2014 15:03:53 -0300 [thread overview]
Message-ID: <20141014180353.GF3198@kernel.org> (raw)
In-Reply-To: <20141014173403.GE3198@kernel.org>
Em Tue, Oct 14, 2014 at 02:34:03PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Oct 14, 2014 at 11:09:58AM +0200, Jiri Olsa escreveu:
> > On Wed, Oct 01, 2014 at 04:50:41PM -0300, Arnaldo Carvalho de Melo wrote:
> > > From: Waiman Long <Waiman.Long@hp.com>
> > > With workload that spawns and destroys many threads and processes, it
> > > was found that perf-mem could took a long time to post-process the perf
> > > data after the target workload had completed its operation.
> > > The performance bottleneck was found to be the lookup and insertion of
> > > the new DSO structures (thousands of them in this case).
> > this change segfaults (below) some tests, but only if I compiled
> > without DEBUG when I revert this commit, I can no longer reproduce..
> Reproduced, looking at it...
Fixed, this happens because we end up using a struct machines on the
stack, and then machines__init() was not initializing the newly
introduced rb_root, just the existing list_head.
When we introduced struct dsos, to group the two ways to store dsos,
i.e. the linked list and the rbtree, we didn't turned the initialization
done in machines__init(machines->host) -> machine__init() ->
INIT_LIST_HEAD into a dsos__init() to keep on initializing the list_head
but _as well_ initializing the rb_root, oops. All worked because outside
perf-test we probably zalloc the whole thing which ends up initializing
it in to NULL.
So the problem looks contained to 'perf test' that uses it on stack,
etc.
Will add your Reported-by, but if you're quick, I can give you a
Tested-by too ;-)
- Arnaldo
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index b7d477fbda02..34fc7c8672e4 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -13,12 +13,18 @@
#include <symbol/kallsyms.h>
#include "unwind.h"
+static void dsos__init(struct dsos *dsos)
+{
+ INIT_LIST_HEAD(&dsos->head);
+ dsos->root = RB_ROOT;
+}
+
int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
{
map_groups__init(&machine->kmaps);
RB_CLEAR_NODE(&machine->rb_node);
- INIT_LIST_HEAD(&machine->user_dsos.head);
- INIT_LIST_HEAD(&machine->kernel_dsos.head);
+ dsos__init(&machine->user_dsos);
+ dsos__init(&machine->kernel_dsos);
machine->threads = RB_ROOT;
INIT_LIST_HEAD(&machine->dead_threads);
next prev parent reply other threads:[~2014-10-14 18:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 19:50 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 1/8] perf tools: Refactor unit and scale function parameters Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 2/8] perf trace: Fix mmap return address truncation to 32-bit Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 3/8] perf bench futex: Support operations for shared futexes Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 4/8] perf bench futex: Sanitize -q option in requeue Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 5/8] perf symbols: Encapsulate dsos list head into struct dsos Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 6/8] perf symbols: Improve DSO long names lookup speed with rbtree Arnaldo Carvalho de Melo
2014-10-14 9:09 ` Jiri Olsa
2014-10-14 17:34 ` Arnaldo Carvalho de Melo
2014-10-14 18:03 ` Arnaldo Carvalho de Melo [this message]
2014-10-15 10:05 ` [tip:perf/urgent] perf machine: Add missing dsos-> root rbtree root initialization tip-bot for Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 7/8] perf tools: Fix build breakage on arm64 targets Arnaldo Carvalho de Melo
2014-10-01 19:50 ` [PATCH 8/8] perf record: Fix error message for --filter option not coming after tracepoint Arnaldo Carvalho de Melo
2014-10-03 3:31 ` [GIT PULL 0/8] perf/core improvements and fixes Ingo Molnar
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=20141014180353.GF3198@kernel.org \
--to=acme@kernel.org \
--cc=Waiman.Long@hp.com \
--cc=adrian.hunter@intel.com \
--cc=doug.hatch@hp.com \
--cc=dzickus@redhat.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=scott.norton@hp.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).