* [PATCH] perf tools: Fix __machine__findnew_thread() error path
@ 2015-01-09 0:38 Namhyung Kim
2015-01-09 10:19 ` Jiri Olsa
2015-01-17 10:11 ` [tip:perf/urgent] perf machine: " tip-bot for Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2015-01-09 0:38 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: LKML, Ingo Molnar, Peter Zijlstra, Jiri Olsa, David Ahern
When thread__init_map_groups() fails, a new thread should be removed
from the rbtree since it's gonna be freed. Also update last match cache
only if the function succeeded.
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/machine.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 94de3e48b490..1bca3a9f2b16 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -389,7 +389,6 @@ static struct thread *__machine__findnew_thread(struct machine *machine,
if (th != NULL) {
rb_link_node(&th->rb_node, parent, p);
rb_insert_color(&th->rb_node, &machine->threads);
- machine->last_match = th;
/*
* We have to initialize map_groups separately
@@ -400,9 +399,12 @@ static struct thread *__machine__findnew_thread(struct machine *machine,
* leader and that would screwed the rb tree.
*/
if (thread__init_map_groups(th, machine)) {
+ rb_erase(&th->rb_node, &machine->threads);
thread__delete(th);
return NULL;
}
+
+ machine->last_match = th;
}
return th;
--
2.2.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools: Fix __machine__findnew_thread() error path
2015-01-09 0:38 [PATCH] perf tools: Fix __machine__findnew_thread() error path Namhyung Kim
@ 2015-01-09 10:19 ` Jiri Olsa
2015-01-17 10:11 ` [tip:perf/urgent] perf machine: " tip-bot for Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2015-01-09 10:19 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, LKML, Ingo Molnar, Peter Zijlstra, David Ahern
On Fri, Jan 09, 2015 at 09:38:12AM +0900, Namhyung Kim wrote:
> When thread__init_map_groups() fails, a new thread should be removed
> from the rbtree since it's gonna be freed. Also update last match cache
> only if the function succeeded.
>
> Reported-by: David Ahern <dsahern@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf machine: Fix __machine__findnew_thread() error path
2015-01-09 0:38 [PATCH] perf tools: Fix __machine__findnew_thread() error path Namhyung Kim
2015-01-09 10:19 ` Jiri Olsa
@ 2015-01-17 10:11 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-01-17 10:11 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, linux-kernel, dsahern, acme, a.p.zijlstra, hpa, namhyung,
tglx, jolsa, jolsa
Commit-ID: 260d819e3abdbdaa2b88fb983d1314f1b263f9e2
Gitweb: http://git.kernel.org/tip/260d819e3abdbdaa2b88fb983d1314f1b263f9e2
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 9 Jan 2015 09:38:12 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Jan 2015 17:49:28 -0300
perf machine: Fix __machine__findnew_thread() error path
When thread__init_map_groups() fails, a new thread should be removed
from the rbtree since it's gonna be freed. Also update last match cache
only if the function succeeded.
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1420763892-15535-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 94de3e4..1bca3a9 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -389,7 +389,6 @@ static struct thread *__machine__findnew_thread(struct machine *machine,
if (th != NULL) {
rb_link_node(&th->rb_node, parent, p);
rb_insert_color(&th->rb_node, &machine->threads);
- machine->last_match = th;
/*
* We have to initialize map_groups separately
@@ -400,9 +399,12 @@ static struct thread *__machine__findnew_thread(struct machine *machine,
* leader and that would screwed the rb tree.
*/
if (thread__init_map_groups(th, machine)) {
+ rb_erase(&th->rb_node, &machine->threads);
thread__delete(th);
return NULL;
}
+
+ machine->last_match = th;
}
return th;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-17 10:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 0:38 [PATCH] perf tools: Fix __machine__findnew_thread() error path Namhyung Kim
2015-01-09 10:19 ` Jiri Olsa
2015-01-17 10:11 ` [tip:perf/urgent] perf machine: " tip-bot for Namhyung Kim
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).