From 912bd566ad7b019aaca37ee4193f949afc34eaae Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 16 Feb 2018 16:42:53 +0000 Subject: runtime: add some more preemption checks In particular this lets BenchmarkPingPongHog in runtime/proc_test.go complete. Reviewed-on: https://go-review.googlesource.com/94735 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257743 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/runtime/proc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libgo/go/runtime/proc.go') diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index edf41405c1c..1d95109d7c0 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -4084,8 +4084,9 @@ func preemptone(_p_ *p) bool { // setting a global variable and figuring out a way to efficiently // check that global variable. // - // For now we check gp.preempt in schedule and mallocgc, - // which is at least better than doing nothing at all. + // For now we check gp.preempt in schedule, mallocgc, selectgo, + // and a few other places, which is at least better than doing + // nothing at all. return true } -- cgit v1.2.1 From 5c86851d15e32cd60677d57bb88ac4a55cd1e03e Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 20 Feb 2018 15:30:31 +0000 Subject: runtime: allow preemption in fast syscall return Let a fast syscall return be a preemption point. This helps with tight loops that make system calls, as in BenchmarkSyscallExcessWork. Reviewed-on: https://go-review.googlesource.com/94895 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257848 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/runtime/proc.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libgo/go/runtime/proc.go') diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index 1d95109d7c0..20fa0ad05be 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -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 } -- cgit v1.2.1