svn commit: r363297 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sat Jul 18 00:14:44 UTC 2020
Author: mjg
Date: Sat Jul 18 00:14:43 2020
New Revision: 363297
URL: https://svnweb.freebsd.org/changeset/base/363297
Log:
Short-circuit tdfind when looking for the calling thread.
Common occurence with cpuset and other places.
Modified:
head/sys/kern/kern_thread.c
Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c Fri Jul 17 23:10:35 2020 (r363296)
+++ head/sys/kern/kern_thread.c Sat Jul 18 00:14:43 2020 (r363297)
@@ -1299,6 +1299,14 @@ tdfind(lwpid_t tid, pid_t pid)
struct thread *td;
int run = 0;
+ td = curthread;
+ if (td->td_tid == tid) {
+ if (pid != -1 && td->td_proc->p_pid != pid)
+ return (NULL);
+ PROC_LOCK(td->td_proc);
+ return (td);
+ }
+
rw_rlock(&tidhash_lock);
LIST_FOREACH(td, TIDHASH(tid), td_hash) {
if (td->td_tid == tid) {
More information about the svn-src-head
mailing list