From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753612AbbE0Quy (ORCPT ); Wed, 27 May 2015 12:50:54 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39066 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589AbbE0Qut (ORCPT ); Wed, 27 May 2015 12:50:49 -0400 Date: Wed, 27 May 2015 09:50:33 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, dzickus@redhat.com, jolsa@redhat.com, acme@redhat.com, namhyung@kernel.org, fweisbec@gmail.com, bp@suse.de, dsahern@gmail.com, tglx@linutronix.de, eranian@google.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org Reply-To: namhyung@kernel.org, acme@redhat.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, fweisbec@gmail.com, tglx@linutronix.de, dsahern@gmail.com, bp@suse.de, eranian@google.com, dzickus@redhat.com, mingo@kernel.org, hpa@zytor.com, jolsa@redhat.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf machine: Mark removed threads as such Git-Commit-ID: 0170b14f5f5462524d05ee96275b7a0a0d34ae77 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0170b14f5f5462524d05ee96275b7a0a0d34ae77 Gitweb: http://git.kernel.org/tip/0170b14f5f5462524d05ee96275b7a0a0d34ae77 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 25 May 2015 15:23:05 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 27 May 2015 12:21:45 -0300 perf machine: Mark removed threads as such We use: BUG_ON(!RB_EMPTY_NODE(&thread->rb_node)); in the thread destructor as a debugging check to find out about possibly still referenced thread instances being deleted, to do that we need to make sure we use RB_CLEAR_NODE() right after rb_erase(), i.e. that we use the newly introduced rb_erase_init(), that works just like list_del_init(). Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-4fcqo5ypy1cjjf15ilb0hn78@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7ec3188..6bf8457 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -400,7 +400,7 @@ 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); + rb_erase_init(&th->rb_node, &machine->threads); RB_CLEAR_NODE(&th->rb_node); thread__delete(th); return NULL; @@ -1314,7 +1314,7 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th, BUG_ON(atomic_read(&th->refcnt) == 0); if (lock) pthread_rwlock_wrlock(&machine->threads_lock); - rb_erase(&th->rb_node, &machine->threads); + rb_erase_init(&th->rb_node, &machine->threads); RB_CLEAR_NODE(&th->rb_node); /* * Move it first to the dead_threads list, then drop the reference,