Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ceb8f6e authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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 <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-98kuesmfwtvhsrzx7ttyb0kt@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8f196013
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
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)