svn commit: r363504 - stable/12/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sat Jul 25 00:03:24 UTC 2020
Author: mjg
Date: Sat Jul 25 00:03:23 2020
New Revision: 363504
URL: https://svnweb.freebsd.org/changeset/base/363504
Log:
MFC r363297:
Short-circuit tdfind when looking for the calling thread.
Modified:
stable/12/sys/kern/kern_thread.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/kern_thread.c
==============================================================================
--- stable/12/sys/kern/kern_thread.c Sat Jul 25 00:01:57 2020 (r363503)
+++ stable/12/sys/kern/kern_thread.c Sat Jul 25 00:03:23 2020 (r363504)
@@ -1260,6 +1260,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-stable
mailing list