Lines Matching refs:th

17 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
313 struct thread *th, pid_t pid) in machine__update_thread_pid() argument
317 if (pid == th->pid_ || pid == -1 || th->pid_ != -1) in machine__update_thread_pid()
320 th->pid_ = pid; in machine__update_thread_pid()
322 if (th->pid_ == th->tid) in machine__update_thread_pid()
325 leader = __machine__findnew_thread(machine, th->pid_, th->pid_); in machine__update_thread_pid()
335 if (th->mg == leader->mg) in machine__update_thread_pid()
338 if (th->mg) { in machine__update_thread_pid()
344 if (!map_groups__empty(th->mg)) in machine__update_thread_pid()
346 th->pid_, th->tid); in machine__update_thread_pid()
347 map_groups__put(th->mg); in machine__update_thread_pid()
350 th->mg = map_groups__get(leader->mg); in machine__update_thread_pid()
355 pr_err("Failed to join map groups for %d:%d\n", th->pid_, th->tid); in machine__update_thread_pid()
364 struct thread *th; in ____machine__findnew_thread() local
371 th = machine->last_match; in ____machine__findnew_thread()
372 if (th != NULL) { in ____machine__findnew_thread()
373 if (th->tid == tid) { in ____machine__findnew_thread()
374 machine__update_thread_pid(machine, th, pid); in ____machine__findnew_thread()
375 return th; in ____machine__findnew_thread()
383 th = rb_entry(parent, struct thread, rb_node); in ____machine__findnew_thread()
385 if (th->tid == tid) { in ____machine__findnew_thread()
386 machine->last_match = th; in ____machine__findnew_thread()
387 machine__update_thread_pid(machine, th, pid); in ____machine__findnew_thread()
388 return th; in ____machine__findnew_thread()
391 if (tid < th->tid) in ____machine__findnew_thread()
400 th = thread__new(pid, tid); in ____machine__findnew_thread()
401 if (th != NULL) { in ____machine__findnew_thread()
402 rb_link_node(&th->rb_node, parent, p); in ____machine__findnew_thread()
403 rb_insert_color(&th->rb_node, &machine->threads); in ____machine__findnew_thread()
413 if (thread__init_map_groups(th, machine)) { in ____machine__findnew_thread()
414 rb_erase_init(&th->rb_node, &machine->threads); in ____machine__findnew_thread()
415 RB_CLEAR_NODE(&th->rb_node); in ____machine__findnew_thread()
416 thread__delete(th); in ____machine__findnew_thread()
422 thread__get(th); in ____machine__findnew_thread()
423 machine->last_match = th; in ____machine__findnew_thread()
426 return th; in ____machine__findnew_thread()
437 struct thread *th; in machine__findnew_thread() local
440 th = thread__get(__machine__findnew_thread(machine, pid, tid)); in machine__findnew_thread()
442 return th; in machine__findnew_thread()
448 struct thread *th; in machine__find_thread() local
450 th = thread__get(____machine__findnew_thread(machine, pid, tid, false)); in machine__find_thread()
452 return th; in machine__find_thread()
1363 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock) in __machine__remove_thread() argument
1365 if (machine->last_match == th) in __machine__remove_thread()
1368 BUG_ON(atomic_read(&th->refcnt) == 0); in __machine__remove_thread()
1371 rb_erase_init(&th->rb_node, &machine->threads); in __machine__remove_thread()
1372 RB_CLEAR_NODE(&th->rb_node); in __machine__remove_thread()
1378 list_add_tail(&th->node, &machine->dead_threads); in __machine__remove_thread()
1381 thread__put(th); in __machine__remove_thread()
1384 void machine__remove_thread(struct machine *machine, struct thread *th) in machine__remove_thread() argument
1386 return __machine__remove_thread(machine, th, true); in machine__remove_thread()