PERFORCE change 48458 for review

Peter Wemm peter at FreeBSD.org
Mon Mar 8 12:05:46 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=48458

Change 48458 by peter at peter_overcee on 2004/03/08 12:05:00

	reduce Giant coverage for non-mpsafe syscalls.
	This should probably be done for all platforms.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/trap.c#41 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/trap.c#41 (text+ko) ====

@@ -758,13 +758,6 @@
 		ktrsyscall(code, narg, argp);
 #endif
 
-	/*
-	 * Try to run the syscall without Giant if the syscall
-	 * is MP safe.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_lock(&Giant);
-
 	if (error == 0) {
 		td->td_retval[0] = 0;
 		td->td_retval[1] = frame.tf_rdx;
@@ -773,7 +766,12 @@
 
 		PTRACESTOP_SC(p, td, S_PT_SCE);
 
-		error = (*callp->sy_call)(td, argp);
+		if ((callp->sy_narg & SYF_MPSAFE) == 0) {
+			mtx_lock(&Giant);
+			error = (*callp->sy_call)(td, argp);
+			mtx_unlock(&Giant);
+		} else
+			error = (*callp->sy_call)(td, argp);
 	}
 
 	switch (error) {
@@ -811,12 +809,6 @@
 	}
 
 	/*
-	 * Release Giant if we previously set it.
-	 */
-	if ((callp->sy_narg & SYF_MPSAFE) == 0)
-		mtx_unlock(&Giant);
-
-	/*
 	 * Traced syscall.
 	 */
 	if (orig_tf_rflags & PSL_T) {


More information about the p4-projects mailing list