svn commit: r367918 - in head/sys: kern sys

Konstantin Belousov kib at FreeBSD.org
Sat Nov 21 10:32:41 UTC 2020


Author: kib
Date: Sat Nov 21 10:32:40 2020
New Revision: 367918
URL: https://svnweb.freebsd.org/changeset/base/367918

Log:
  Stop using eventhandler to invoke umtx_exec hook.
  
  There is no point in dynamic registration, umtx hook is there always.
  
  Reviewed by:	mjg
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D27303

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_umtx.c
  head/sys/sys/umtx.h

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Sat Nov 21 03:27:32 2020	(r367917)
+++ head/sys/kern/kern_exec.c	Sat Nov 21 10:32:40 2020	(r367918)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
+#include <sys/umtx.h>
 #include <sys/vnode.h>
 #include <sys/wait.h>
 #ifdef KTRACE
@@ -1047,8 +1048,8 @@ exec_new_vmspace(struct image_params *imgp, struct sys
 	imgp->sysent = sv;
 
 	sigfastblock_clear(td);
+	umtx_exec(p);
 
-	/* May be called with Giant held */
 	EVENTHANDLER_DIRECT_INVOKE(process_exec, p, imgp);
 
 	/*

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Sat Nov 21 03:27:32 2020	(r367917)
+++ head/sys/kern/kern_umtx.c	Sat Nov 21 10:32:40 2020	(r367918)
@@ -446,8 +446,6 @@ umtxq_sysinit(void *arg __unused)
 	umtx_init_profiling();
 #endif
 	mtx_init(&umtx_lock, "umtx lock", NULL, MTX_DEF);
-	EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL,
-	    EVENTHANDLER_PRI_ANY);
 	umtx_shm_init();
 }
 
@@ -4356,12 +4354,11 @@ umtx_thread_alloc(struct thread *td)
  * exec() hook.
  *
  * Clear robust lists for all process' threads, not delaying the
- * cleanup to thread_exit hook, since the relevant address space is
+ * cleanup to thread exit, since the relevant address space is
  * destroyed right now.
  */
-static void
-umtx_exec_hook(void *arg __unused, struct proc *p,
-    struct image_params *imgp __unused)
+void
+umtx_exec(struct proc *p)
 {
 	struct thread *td;
 
@@ -4383,7 +4380,7 @@ umtx_exec_hook(void *arg __unused, struct proc *p,
 }
 
 /*
- * thread_exit() hook.
+ * thread exit hook.
  */
 void
 umtx_thread_exit(struct thread *td)

Modified: head/sys/sys/umtx.h
==============================================================================
--- head/sys/sys/umtx.h	Sat Nov 21 03:27:32 2020	(r367917)
+++ head/sys/sys/umtx.h	Sat Nov 21 10:32:40 2020	(r367918)
@@ -188,6 +188,7 @@ umtx_key_match(const struct umtx_key *k1, const struct
 }
 
 int umtx_copyin_timeout(const void *, struct timespec *);
+void umtx_exec(struct proc *p);
 int umtx_key_get(const void *, int, int, struct umtx_key *);
 void umtx_key_release(struct umtx_key *);
 struct umtx_q *umtxq_alloc(void);


More information about the svn-src-all mailing list