Date: Sat, 25 Jul 2020 00:03:24 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363504 - stable/12/sys/kern Message-ID: <202007250003.06P03OuB041166@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007250003.06P03OuB041166>