From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933827AbbEOGp6 (ORCPT ); Fri, 15 May 2015 02:45:58 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58253 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932393AbbEOGpx (ORCPT ); Fri, 15 May 2015 02:45:53 -0400 Date: Thu, 14 May 2015 23:45:37 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: tglx@linutronix.de, fweisbec@gmail.com, hpa@zytor.com, bp@suse.de, linux-kernel@vger.kernel.org, namhyung@kernel.org, mingo@kernel.org, dsahern@gmail.com, dzickus@redhat.com, acme@redhat.com, jolsa@redhat.com, eranian@google.com, adrian.hunter@intel.com Reply-To: mingo@kernel.org, dsahern@gmail.com, namhyung@kernel.org, tglx@linutronix.de, fweisbec@gmail.com, hpa@zytor.com, bp@suse.de, linux-kernel@vger.kernel.org, acme@redhat.com, dzickus@redhat.com, eranian@google.com, jolsa@redhat.com, adrian.hunter@intel.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf machine: No need to keep a refcnt for last_match Git-Commit-ID: 0ceb8f6e6cbafee0fa0e671e48213e24fae887f7 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: 0ceb8f6e6cbafee0fa0e671e48213e24fae887f7 Gitweb: http://git.kernel.org/tip/0ceb8f6e6cbafee0fa0e671e48213e24fae887f7 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 11 May 2015 18:08:12 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 12 May 2015 09:59:52 -0300 perf machine: No need to keep a refcnt for last_match Since it is all associated with the refcount for keeping the thread in the rbtree, it is excessive and unecessarily complex to hold a refcont when changing machine->last_match. 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-98kuesmfwtvhsrzx7ttyb0kt@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 8b0b307..34bf89f 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -364,7 +364,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine, return th; } - thread__zput(machine->last_match); + machine->last_match = NULL; } while (*p != NULL) { @@ -372,7 +372,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine, th = rb_entry(parent, struct thread, rb_node); if (th->tid == tid) { - machine->last_match = thread__get(th); + machine->last_match = th; machine__update_thread_pid(machine, th, pid); return th; } @@ -409,7 +409,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine, * It is now in the rbtree, get a ref */ thread__get(th); - machine->last_match = thread__get(th); + machine->last_match = th; } return th; @@ -1309,7 +1309,7 @@ out_problem: static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock) { if (machine->last_match == th) - thread__zput(machine->last_match); + machine->last_match = NULL; BUG_ON(th->refcnt.counter == 0); if (lock)