libgo patch committed: Check for preemption in fast syscall return

Message ID CAOyqgcV5oYjB3mEq5O858UpidYnxYvxUsocyZ31DGjGWPabwng@mail.gmail.com
State New
Headers show
Series
  • libgo patch committed: Check for preemption in fast syscall return
Related show

Commit Message

Ian Lance Taylor Feb. 20, 2018, 3:30 p.m.
This libgo patch checks for preemption in the fast return path from a
system call.  This helps with tight loops that make system calls, as
in BenchmarkSyscallExcessWork.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 257845)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-459a8a94e04a19bde7173ef7cf2db369c2e62e2d
+c6e0970f75508e209a10a7db5164d6ea3f9b28bf
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/runtime/proc.go
===================================================================
--- libgo/go/runtime/proc.go	(revision 257743)
+++ libgo/go/runtime/proc.go	(working copy)
@@ -2794,6 +2794,13 @@  func exitsyscall(dummy int32) {
 		exitsyscallclear(_g_)
 		_g_.m.locks--
 		_g_.throwsplit = false
+
+		// Check preemption, since unlike gc we don't check on
+		// every call.
+		if getg().preempt {
+			checkPreempt()
+		}
+
 		return
 	}