Avoid allproc lock in pfind if curproc->pid == pid

This commit is contained in:
Mateusz Guzik 2017-11-11 18:03:26 +00:00
parent 9b57bf75d0
commit 272640b7fc

View File

@ -342,6 +342,11 @@ pfind(pid_t pid)
{
struct proc *p;
p = curproc;
if (p->p_pid == pid) {
PROC_LOCK(p);
return (p);
}
sx_slock(&allproc_lock);
p = pfind_locked(pid);
sx_sunlock(&allproc_lock);