Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 2004 12:05:45 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 48458 for review
Message-ID:  <200403082005.i28K5jn4035226@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=48458

Change 48458 by peter@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) {



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