Add stop_all_proc_block(9)
It allows to have more than one consumer of thread_signle(SIGNLE_ALLPROC) by serializing them. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35014
This commit is contained in:
parent
54a11adbd9
commit
2e7595ef2f
@ -3396,6 +3396,21 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC_VM_LAYOUT, vm_layout, CTLFLAG_RD |
|
||||
CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_vm_layout,
|
||||
"Process virtual address space layout info");
|
||||
|
||||
static struct sx stop_all_proc_blocker;
|
||||
SX_SYSINIT(stop_all_proc_blocker, &stop_all_proc_blocker, "sapblk");
|
||||
|
||||
void
|
||||
stop_all_proc_block(void)
|
||||
{
|
||||
sx_xlock(&stop_all_proc_blocker);
|
||||
}
|
||||
|
||||
void
|
||||
stop_all_proc_unblock(void)
|
||||
{
|
||||
sx_xunlock(&stop_all_proc_blocker);
|
||||
}
|
||||
|
||||
int allproc_gen;
|
||||
|
||||
/*
|
||||
@ -3411,6 +3426,8 @@ stop_all_proc(void)
|
||||
int r, gen;
|
||||
bool restart, seen_stopped, seen_exiting, stopped_some;
|
||||
|
||||
stop_all_proc_block();
|
||||
|
||||
cp = curproc;
|
||||
allproc_loop:
|
||||
sx_xlock(&allproc_lock);
|
||||
@ -3502,6 +3519,8 @@ resume_all_proc(void)
|
||||
goto again;
|
||||
}
|
||||
sx_xunlock(&allproc_lock);
|
||||
|
||||
stop_all_proc_unblock();
|
||||
}
|
||||
|
||||
/* #define TOTAL_STOP_DEBUG 1 */
|
||||
|
@ -1232,6 +1232,8 @@ void thread_unlink(struct thread *td);
|
||||
void thread_unsuspend(struct proc *p);
|
||||
void thread_wait(struct proc *p);
|
||||
|
||||
void stop_all_proc_block(void);
|
||||
void stop_all_proc_unblock(void);
|
||||
void stop_all_proc(void);
|
||||
void resume_all_proc(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user