mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-24 17:48:18 +07:00
perf machine: Add threads__set_last_match function
Separating threads::last_match cache set into separate threads__set_last_match function. This will be useful in following patch. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Lukasz Odzioba <lukasz.odzioba@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20180719143345.12963-3-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f8b2ebb532
commit
67fda0f32c
@ -431,6 +431,12 @@ threads__get_last_match(struct threads *threads, struct machine *machine,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
threads__set_last_match(struct threads *threads, struct thread *th)
|
||||||
|
{
|
||||||
|
threads->last_match = th;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Caller must eventually drop thread->refcnt returned with a successful
|
* Caller must eventually drop thread->refcnt returned with a successful
|
||||||
* lookup/new thread inserted.
|
* lookup/new thread inserted.
|
||||||
@ -453,7 +459,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine,
|
|||||||
th = rb_entry(parent, struct thread, rb_node);
|
th = rb_entry(parent, struct thread, rb_node);
|
||||||
|
|
||||||
if (th->tid == tid) {
|
if (th->tid == tid) {
|
||||||
threads->last_match = th;
|
threads__set_last_match(threads, th);
|
||||||
machine__update_thread_pid(machine, th, pid);
|
machine__update_thread_pid(machine, th, pid);
|
||||||
return thread__get(th);
|
return thread__get(th);
|
||||||
}
|
}
|
||||||
@ -490,7 +496,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine,
|
|||||||
* It is now in the rbtree, get a ref
|
* It is now in the rbtree, get a ref
|
||||||
*/
|
*/
|
||||||
thread__get(th);
|
thread__get(th);
|
||||||
threads->last_match = th;
|
threads__set_last_match(threads, th);
|
||||||
++threads->nr;
|
++threads->nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1648,7 +1654,7 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th,
|
|||||||
struct threads *threads = machine__threads(machine, th->tid);
|
struct threads *threads = machine__threads(machine, th->tid);
|
||||||
|
|
||||||
if (threads->last_match == th)
|
if (threads->last_match == th)
|
||||||
threads->last_match = NULL;
|
threads__set_last_match(threads, NULL);
|
||||||
|
|
||||||
BUG_ON(refcount_read(&th->refcnt) == 0);
|
BUG_ON(refcount_read(&th->refcnt) == 0);
|
||||||
if (lock)
|
if (lock)
|
||||||
|
Loading…
Reference in New Issue
Block a user