Avoid allproc lock in pfind if curproc->pid == pid
This commit is contained in:
parent
9b57bf75d0
commit
272640b7fc
@ -342,6 +342,11 @@ pfind(pid_t pid)
|
|||||||
{
|
{
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
|
||||||
|
p = curproc;
|
||||||
|
if (p->p_pid == pid) {
|
||||||
|
PROC_LOCK(p);
|
||||||
|
return (p);
|
||||||
|
}
|
||||||
sx_slock(&allproc_lock);
|
sx_slock(&allproc_lock);
|
||||||
p = pfind_locked(pid);
|
p = pfind_locked(pid);
|
||||||
sx_sunlock(&allproc_lock);
|
sx_sunlock(&allproc_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user