Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2022 01:29:25 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 853c4ef74843 - stable/13 - Remove struct proc p_singlethr member
Message-ID:  <202209030129.2831TPpO002670@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=853c4ef748430f5a5e7e35a672180ad70be426cf

commit 853c4ef748430f5a5e7e35a672180ad70be426cf
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-12 19:59:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-03 01:17:36 +0000

    Remove struct proc p_singlethr member
    
    (cherry picked from commit 5e5675cb4bfa80b6026b5c781d6fa2cc9254468f)
---
 sys/kern/kern_exec.c    | 9 ---------
 sys/kern/kern_exit.c    | 2 --
 sys/kern/kern_fork.c    | 9 ---------
 sys/kern/kern_procctl.c | 6 ------
 sys/sys/proc.h          | 2 --
 5 files changed, 28 deletions(-)

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 1848bf5234bb..d8e1779825c6 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 ca32f318c0cf..aca2ca81f057 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 862e61bad207..d6d90dd9534c 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -318,17 +318,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);
@@ -393,7 +385,6 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread *
 
 	bzero(&p2->p_startzero,
 	    __rangeof(struct proc, p_startzero, p_endzero));
-	p2->p_singlethr = 0;
 
 	/* Tell the prison that we exist. */
 	prison_proc_hold(p2->p_ucred->cr_prison);
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/sys/proc.h b/sys/sys/proc.h
index 686a9aacdfdd..50e99d5a94c8 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -727,8 +727,6 @@ struct proc {
 	char		*p_binname;	/* (b) Binary hardlink name. */
 	void		*p_elf_brandinfo; /* (x) Elf_Brandinfo, NULL for
 						 non ELF binaries. */
-	int		p_singlethr;	/* (c) Count of threads doing
-					   external thread_single() */
 };
 
 #define	p_session	p_pgrp->pg_session



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209030129.2831TPpO002670>