Avoid calling _PHOLD(p1) with p2's lock held, since _PHOLD()
may block to swap in p1. Instead, call _PHOLD earlier, at a point where the only lock held happens to be p1's.
This commit is contained in:
parent
616b5f90d3
commit
299bc7367d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136005
@ -533,8 +533,14 @@ fork1(td, flags, pages, procp)
|
||||
* p_limit is copy-on-write. Bump its refcount.
|
||||
*/
|
||||
p2->p_limit = lim_hold(p1->p_limit);
|
||||
PROC_UNLOCK(p1);
|
||||
|
||||
/*
|
||||
* We don't need to prevent the parent from being swapped out just yet,
|
||||
* but this is a convenient point to block to swap it in if needed.
|
||||
*/
|
||||
PROC_UNLOCK(p2);
|
||||
_PHOLD(p1);
|
||||
PROC_UNLOCK(p1);
|
||||
|
||||
/* Bump references to the text vnode (for procfs) */
|
||||
if (p2->p_textvp)
|
||||
@ -629,9 +635,8 @@ fork1(td, flags, pages, procp)
|
||||
|
||||
/*
|
||||
* This begins the section where we must prevent the parent
|
||||
* from being swapped.
|
||||
* from being swapped. We already got a hold on the parent earlier.
|
||||
*/
|
||||
_PHOLD(p1);
|
||||
PROC_UNLOCK(p1);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user