Remove struct proc p_singlethr member

It does not serve any purpose after we stopped doing
thread_single(SINGLE_ALLPROC) from stoppable user processes.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36207
This commit is contained in:
Konstantin Belousov 2022-08-12 22:59:56 +03:00
parent 2842ec6d99
commit 5e5675cb4b
6 changed files with 3 additions and 30 deletions

View File

@ -307,17 +307,8 @@ pre_execve(struct thread *td, struct vmspace **oldvmspace)
p = td->td_proc;
if ((p->p_flag & P_HADTHREADS) != 0) {
PROC_LOCK(p);
while (p->p_singlethr > 0) {
error = msleep(&p->p_singlethr, &p->p_mtx,
PWAIT | PCATCH, "exec1t", 0);
if (error != 0) {
error = ERESTART;
goto unlock;
}
}
if (thread_single(p, SINGLE_BOUNDARY) != 0)
error = ERESTART;
unlock:
PROC_UNLOCK(p);
}
KASSERT(error != 0 || (td->td_pflags & TDP_EXECVMSPC) == 0,

View File

@ -218,8 +218,6 @@ proc_set_p2_wexit(struct proc *p)
{
PROC_LOCK_ASSERT(p, MA_OWNED);
p->p_flag2 |= P2_WEXIT;
while (p->p_singlethr > 0)
msleep(&p->p_singlethr, &p->p_mtx, PWAIT | PCATCH, "exit1t", 0);
}
/*

View File

@ -319,17 +319,9 @@ fork_norfproc(struct thread *td, int flags)
* must ensure that other threads do not concurrently create a second
* process sharing the vmspace, see vmspace_unshare().
*/
again:
if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS &&
((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) {
PROC_LOCK(p1);
if (p1->p_singlethr > 0) {
error = msleep(&p1->p_singlethr, &p1->p_mtx,
PWAIT | PCATCH | PDROP, "rfork1t", 0);
if (error != 0)
return (ERESTART);
goto again;
}
if (thread_single(p1, SINGLE_BOUNDARY)) {
PROC_UNLOCK(p1);
return (ERESTART);

View File

@ -477,15 +477,9 @@ reap_kill_subtree(struct thread *td, struct proc *p, struct proc *reaper,
PROC_UNLOCK(td->td_proc);
goto out;
}
td->td_proc->p_singlethr++;
PROC_UNLOCK(td->td_proc);
while (reap_kill_subtree_once(td, p, reaper, &pids, w))
;
PROC_LOCK(td->td_proc);
td->td_proc->p_singlethr--;
if (td->td_proc->p_singlethr == 0)
wakeup(&p->p_singlethr);
PROC_UNLOCK(td->td_proc);
out:
clean_unrhdr(&pids);
clear_unrhdr(&pids);

View File

@ -99,7 +99,7 @@ _Static_assert(offsetof(struct proc, p_pid) == 0xc4,
"struct proc KBI p_pid");
_Static_assert(offsetof(struct proc, p_filemon) == 0x3c8,
"struct proc KBI p_filemon");
_Static_assert(offsetof(struct proc, p_comm) == 0x3e4,
_Static_assert(offsetof(struct proc, p_comm) == 0x3e0,
"struct proc KBI p_comm");
_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c8,
"struct proc KBI p_emuldata");
@ -119,9 +119,9 @@ _Static_assert(offsetof(struct proc, p_pid) == 0x78,
"struct proc KBI p_pid");
_Static_assert(offsetof(struct proc, p_filemon) == 0x270,
"struct proc KBI p_filemon");
_Static_assert(offsetof(struct proc, p_comm) == 0x288,
_Static_assert(offsetof(struct proc, p_comm) == 0x284,
"struct proc KBI p_comm");
_Static_assert(offsetof(struct proc, p_emuldata) == 0x314,
_Static_assert(offsetof(struct proc, p_emuldata) == 0x310,
"struct proc KBI p_emuldata");
#endif

View File

@ -720,8 +720,6 @@ struct proc {
int p_pendingexits; /* (c) Count of pending thread exits. */
struct filemon *p_filemon; /* (c) filemon-specific data. */
int p_pdeathsig; /* (c) Signal from parent on exit. */
int p_singlethr; /* (c) Count of threads doing
external thread_single() */
/* End area that is zeroed on creation. */
#define p_endzero p_magic