git: 5e5675cb4bfa - main - Remove struct proc p_singlethr member
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 20 Aug 2022 17:35:02 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5e5675cb4bfa80b6026b5c781d6fa2cc9254468f
commit 5e5675cb4bfa80b6026b5c781d6fa2cc9254468f
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-12 19:59:56 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-20 17:34:30 +0000
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
---
sys/kern/kern_exec.c | 9 ---------
sys/kern/kern_exit.c | 2 --
sys/kern/kern_fork.c | 8 --------
sys/kern/kern_procctl.c | 6 ------
sys/kern/kern_thread.c | 6 +++---
sys/sys/proc.h | 2 --
6 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 0ead8d81fe59..364c10987ea6 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -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,
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 4c3821ddfa72..cb51193a26e0 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -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);
}
/*
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index c71a0422b1e2..b4f96686caba 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -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);
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
index 1fb1183741d6..9d48b04dde48 100644
--- a/sys/kern/kern_procctl.c
+++ b/sys/kern/kern_procctl.c
@@ -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);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index a15488b29cb6..bfd153844464 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -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
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 9d55f0b71e4f..8c2aa6391d69 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -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